Simple CPP failure (snapshot 20000313)

Jonathan Larmour jlarmour@redhat.co.uk
Wed Mar 22 12:23:00 GMT 2000


This is with the 20000313 gcc snapshot with both sh-elf and thumb-elf
targets. But I'm sure it's generic... Just in case, this is red hat linux
6.1.

CPP does not deal with the following file correctly:

-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-
#define X (16*(40) + 192)
#define Y 2048

#if Y < X
#undef Y
#define Y X
#endif

Y
-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-

If you invoke cpp on this directly (i.e. ..../cpp foo.c)

you get the output:

-=-=-=-
GNU CPP version 2.96 20000313 (experimental) (cpplib)
 (Thumb/elf)
ignoring nonexistent directory
`/home/jlarmour/sourceware/test/thumb-elf/H-i686-pc-linux-gnu/thumb-elf/sys-include'
#include "..." search starts here:
#include <...> search starts here:

/home/jlarmour/sourceware/test/thumb-elf/H-i686-pc-linux-gnu/lib/gcc-lib/thumb-elf/2.96/include

/home/jlarmour/sourceware/test/thumb-elf/H-i686-pc-linux-gnu/thumb-elf/include
End of search list.
# 1 "foo.c"
 
 
 
 
 
 
 
 
 
(16*(40) +
192)                                                               -=-=-=-

However the correct value should have been Y! ((16*(40) + 192) = 832). If
you increase the initial value of Y, it start working. If you move X around
a bit, it starts working.

It's a bug.

Jifl
-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault


More information about the Gcc-bugs mailing list