Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*
792 ディスカッション

slight delay when a console application exit

mrusso
初心者
2,222件の閲覧回数

Hi,

I made a console application which print something and then exit, after printing instead of exit immediately, like the same application compiled with other compilers it delays the exit, what would be the reason for that?

0 件の賞賛
1 解決策
mrusso
初心者
1,907件の閲覧回数

Ok I found the issue:

Basically before the loop that follows, I have:

v85 = v5 + 1;

v87 = 1;

for ( j = v87; j <= v83; ++j ) //V87 TRAIN FROM, V83 PREDICT TO

{

  *(int *)(handle + sizeof(int) * j) = *(int *)(byte_4BC818 + sizeof(int) * j); 

}

 

so I had to move the line v85 = v5 + 1; after the scanf that counts how many values are in the data file, v5 is the counter.

元の投稿で解決策を見る

11 返答(返信)
Alex_Y_Intel
モデレーター
2,129件の閲覧回数

Why is it related to Intel DPC++/C++ compiler? 

mrusso
初心者
2,123件の閲覧回数

Hi,

The issue seems related to optimization, when turned off, works fine, when turn on, sometime got output and sometime no output but always delay in exit.

Alex_Y_Intel
モデレーター
2,122件の閲覧回数

A reproducer and exact commands used need to be provided for understanding your issue. 

mrusso
初心者
1,968件の閲覧回数

These are the commands:

icx /QxHOST /Ot /Qansi-alias -Qipo VRA.c -o VRASPEED
icx /QxHOST /O1 /Qansi-alias VRA.c -o VRASIZE
icx /QxHOST /O2 /Qansi-alias -Qipo VRA.c -o VRASPEED1
icx /QxHOST /O3 /Qansi-alias -Qipo VRA.c -o VRAMAXSPEED
icx /QxHOST /Os /Qansi-alias VRA.c -o VRASIZE2
icx /QxHOST /Ot /Qiiansi-alias -Qipo VRA.c -o VRASPEED2
icx /QxHOST /Od /Qansi-alias -Qipo VRA.c -o VRADISABLE ; THIS IS THE ONLY ONE THAT WORKS FINE.

 

and also tried:

 

icx /QxHOST /Ot /Qansi-alias -Qipo VRA.c -o VRASPEED -fprofile-instr-generate
VRASPEED 1.txt 3 2
llvm-profdata merge -output=code.profdata default.profraw
icx /QxHOST /Ot /Qansi-alias -Qipo VRA.c -o VRASPEED -fprofile-instr-use=code.profdata

icx /QxHOST /O1 /Qansi-alias VRA.c -o VRASIZE -fprofile-instr-generate
VRASIZE 1.txt 3 2
llvm-profdata merge -output=code.profdata default.profraw
icx /QxHOST /O1 /Qansi-alias VRA.c -o VRASIZE -fprofile-instr-use=code.profdata

icx /QxHOST /O2 /Qansi-alias -Qipo VRA.c -o VRASPEED1 -fprofile-instr-generate
VRASPEED1 1.txt 3 2
llvm-profdata merge -output=code.profdata default.profraw
icx /QxHOST /O2 /Qansi-alias -Qipo VRA.c -o VRASPEED1 -fprofile-instr-use=code.profdata


icx /QxHOST /O3 /Qansi-alias -Qipo VRA.c -o VRAMAXSPEED -fprofile-instr-generate
VRAMAXSPEED 1.txt 3 2
llvm-profdata merge -output=code.profdata default.profraw
icx /QxHOST /O3 /Qansi-alias -Qipo VRA.c -o VRAMAXSPEED -fprofile-instr-use=code.profdata


icx /QxHOST /Os /Qansi-alias VRA.c -o VRASIZE2 -fprofile-instr-generate
VRASIZE2 1.txt 3 2
llvm-profdata merge -output=code.profdata default.profraw
icx /QxHOST /Os /Qansi-alias VRA.c -o VRASIZE2 -fprofile-instr-use=code.profdata


icx /QxHOST /Ot /Qiiansi-alias -Qipo VRA.c -o VRASPEED2 -fprofile-instr-generate
VRASPEED2 1.txt 3 2
llvm-profdata merge -output=code.profdata default.profraw
icx /QxHOST /Ot /Qansi-alias -Qipo VRA.c -o VRASPEED2 -fprofile-instr-use=code.profdata


icx /QxHOST /Od /Qansi-alias -Qipo VRA.c -o VRADISABLE -fprofile-instr-generate
VRADISABLE 1.txt 3 2
llvm-profdata merge -output=code.profdata default.profraw
icx /QxHOST /Od /Qansi-alias -Qipo VRA.c -o VRADISABLE -fprofile-instr-use=code.profdata

 

 

mrusso
初心者
1,968件の閲覧回数

icx /QxHOST /Ot /Qansi-alias -Qipo VRA.c -o VRASPEED
icx /QxHOST /O1 /Qansi-alias VRA.c -o VRASIZE
icx /QxHOST /O2 /Qansi-alias -Qipo VRA.c -o VRASPEED1
icx /QxHOST /O3 /Qansi-alias -Qipo VRA.c -o VRAMAXSPEED
icx /QxHOST /Os /Qansi-alias VRA.c -o VRASIZE2
icx /QxHOST /Ot /Qiiansi-alias -Qipo VRA.c -o VRASPEED2
icx /QxHOST /Od /Qansi-alias -Qipo VRA.c -o VRADISABLE

 

 

 

 

 

icx /QxHOST /Ot /Qansi-alias -Qipo VRA.c -o VRASPEED -fprofile-instr-generate
VRASPEED 1.txt 3 2
llvm-profdata merge -output=code.profdata default.profraw
icx /QxHOST /Ot /Qansi-alias -Qipo VRA.c -o VRASPEED -fprofile-instr-use=code.profdata

icx /QxHOST /O1 /Qansi-alias VRA.c -o VRASIZE -fprofile-instr-generate
VRASIZE 1.txt 3 2
llvm-profdata merge -output=code.profdata default.profraw
icx /QxHOST /O1 /Qansi-alias VRA.c -o VRASIZE -fprofile-instr-use=code.profdata

icx /QxHOST /O2 /Qansi-alias -Qipo VRA.c -o VRASPEED1 -fprofile-instr-generate
VRASPEED1 1.txt 3 2
llvm-profdata merge -output=code.profdata default.profraw
icx /QxHOST /O2 /Qansi-alias -Qipo VRA.c -o VRASPEED1 -fprofile-instr-use=code.profdata


icx /QxHOST /O3 /Qansi-alias -Qipo VRA.c -o VRAMAXSPEED -fprofile-instr-generate
VRAMAXSPEED 1.txt 3 2
llvm-profdata merge -output=code.profdata default.profraw
icx /QxHOST /O3 /Qansi-alias -Qipo VRA.c -o VRAMAXSPEED -fprofile-instr-use=code.profdata


icx /QxHOST /Os /Qansi-alias VRA.c -o VRASIZE2 -fprofile-instr-generate
VRASIZE2 1.txt 3 2
llvm-profdata merge -output=code.profdata default.profraw
icx /QxHOST /Os /Qansi-alias VRA.c -o VRASIZE2 -fprofile-instr-use=code.profdata


icx /QxHOST /Ot /Qiiansi-alias -Qipo VRA.c -o VRASPEED2 -fprofile-instr-generate
VRASPEED2 1.txt 3 2
llvm-profdata merge -output=code.profdata default.profraw
icx /QxHOST /Ot /Qansi-alias -Qipo VRA.c -o VRASPEED2 -fprofile-instr-use=code.profdata


icx /QxHOST /Od /Qansi-alias -Qipo VRA.c -o VRADISABLE -fprofile-instr-generate
VRADISABLE 1.txt 3 2
llvm-profdata merge -output=code.profdata default.profraw
icx /QxHOST /Od /Qansi-alias -Qipo VRA.c -o VRADISABLE -fprofile-instr-use=code.profdata

 

mrusso
初心者
2,111件の閲覧回数

icx /QxHOST /Ot /Qansi-alias -Qipo VRA.c -o VRASPEED
icx /QxHOST /O1 /Qansi-alias VRA.c -o VRASIZE
icx /QxHOST /O2 /Qansi-alias -Qipo VRA.c -o VRASPEED1
icx /QxHOST /O3 /Qansi-alias -Qipo VRA.c -o VRAMAXSPEED
icx /QxHOST /Os /Qansi-alias VRA.c -o VRASIZE2
icx /QxHOST /Ot /Qiiansi-alias -Qipo VRA.c -o VRASPEED2
icx /QxHOST /Od /Qansi-alias -Qipo VRA.c -o VRADISABLE

 

 

 

 

 

 

 

Alex_Y_Intel
モデレーター
2,094件の閲覧回数

What is VRA.c ?

mrusso
初心者
2,090件の閲覧回数
Alex_Y_Intel
モデレーター
2,071件の閲覧回数

We need to have your VRA.c source file to duplicate your observation and investigate it. 

mrusso
初心者
2,062件の閲覧回数

to run as vra.exe 1.txt 3 2

Also please note that it works only if optimizations are disabled.

On same other compilers it works even with optimizations.

mrusso
初心者
1,908件の閲覧回数

Ok I found the issue:

Basically before the loop that follows, I have:

v85 = v5 + 1;

v87 = 1;

for ( j = v87; j <= v83; ++j ) //V87 TRAIN FROM, V83 PREDICT TO

{

  *(int *)(handle + sizeof(int) * j) = *(int *)(byte_4BC818 + sizeof(int) * j); 

}

 

so I had to move the line v85 = v5 + 1; after the scanf that counts how many values are in the data file, v5 is the counter.

返信