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]

macros parsed wrong



This test case generated from sim/mips build failure gives unexpected
results with "gcc -E foo.c".  This is with today's gcc.

#define CONCAT2(a, b) a ## b
#define XCONCAT2(a, b) CONCAT2(a,b)
#define T2H_16(X) endian_t2h_16(X)
#define T2H_M XCONCAT2(T2H_,M)
#define N 16
#define M N
#define unsigned_M XCONCAT2(unsigned_,M)

1 T2H_M
2 unsigned_M
3 T2H_M unsigned_M

The unexpected results are:

# 1 "/tmp/macros.c"
# 9 "/tmp/macros.c"
1 T2H_16 2
  unsigned_16
3 T2H_16 XCONCAT2(unsigned_,16)

gcc from RH6.2 gives something more expected:

1   T2H_16       
2   unsigned_16       
3   T2H_16          unsigned_16       

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