This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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 <stdio.h>

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]