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*
734 Discussions

slight delay when a console application exit

mrusso
Novice
1,408 Views

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 Kudos
1 Solution
mrusso
Novice
1,093 Views

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.

View solution in original post

0 Kudos
11 Replies
Alex_Y_Intel
Moderator
1,315 Views

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

0 Kudos
mrusso
Novice
1,309 Views

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.

0 Kudos
Alex_Y_Intel
Moderator
1,308 Views

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

0 Kudos
mrusso
Novice
1,154 Views

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

 

 

0 Kudos
mrusso
Novice
1,154 Views

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

 

0 Kudos
mrusso
Novice
1,297 Views

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

 

 

 

 

 

 

 

0 Kudos
Alex_Y_Intel
Moderator
1,280 Views

What is VRA.c ?

0 Kudos
mrusso
Novice
1,276 Views
0 Kudos
Alex_Y_Intel
Moderator
1,257 Views

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

0 Kudos
mrusso
Novice
1,248 Views

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.

0 Kudos
mrusso
Novice
1,094 Views

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.

0 Kudos
Reply