[Bug c/36521] Expression in for expression gets wrong value
--- Comment #1 from peter at xmos dot com 2008-06-13 08:52 --- Created an attachment (id=15760) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15760&action=view) test.i -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36521
[Bug c/36521] New: Expression in for expression gets wrong value
The program below on gcc 4.1.2 prints: > gcc4 test.c > ./a.out got 0 x y done -- The program below on gcc 3.4.4 prints: > gcc test.c > ./a.out got 0 x y and then locks up... -- #include int main() { unsigned int var102 = 1; int a = ( var102 >> 0x1eU & sizeof 290 ); printf("got %d\n", a); fflush(stdout); for ( ; 0; ) {} printf("x\n"); fflush(stdout); for ( ; a; ) {} printf("y\n"); fflush(stdout); for ( ; ( var102 >> 0x1eU & sizeof 290 ); ) // Fails here {} printf("done\n"); return 0; } -- Summary: Expression in for expression gets wrong value Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: peter at xmos dot com GCC build triplet: gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125) GCC host triplet: CYGWIN_NT-5.1 duane 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygw http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36521
[Bug c/36077] Expressions result is wrong
--- Comment #2 from peter at xmos dot com 2008-04-29 10:23 --- Created an attachment (id=15544) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15544&action=view) test.i -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36077
[Bug c/36077] Expressions result is wrong
--- Comment #1 from peter at xmos dot com 2008-04-29 10:23 --- Created an attachment (id=15543) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15543&action=view) test.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36077
[Bug c/36077] New: Expressions result is wrong
I am developing a test generator for in house compilers and have come across a difference where gcc does not agree with our compilers or the Microsoft compiler. The result t1_2a of the expression is what differs between gcc and other compilers. This is on gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-9), and does not matter what the platform is. Compiled with: $ gcc4 test.c -o test.exe $ ./test.exe Error: t1_2a t1_2b 22a8b02e t1_2c 0 Working: t2_2a 0 t2_2b 0 When compared to running on Visual Studio: $ cl test.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. test.c Microsoft (R) Incremental Linker Version 8.00.50727.762 Copyright (C) Microsoft Corporation. All rights reserved. /out:test.exe test.obj $ ./test.exe Error: t1_2a 0 t1_2b 22a8b02e t1_2c 0 Working: t2_2a 0 t2_2b 0 -- Summary: Expressions result is wrong Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: peter at xmos dot com GCC build triplet: gcc version 4.1.2 20070626 (Red Hat 4.1.2-14) GCC host triplet: Linux 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:56:44 EST 2007 x86_64 x GCC target triplet: Target: x86_64-redhat-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36077