https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69746

            Bug ID: 69746
           Summary: [6 Regression] diagnostic about non-constant
                    expression not helpful
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

#define SIZEOF_INT 4
#define ASSERT(e) extern int test[1-2*!(e)];

ASSERT((1 << (8*SIZEOF_INT-1)) < 0)

since GCC 6 results in

t.c:2:30: error: variably modified ‘test’ at file scope
 #define ASSERT(e) extern int test[1-2*!(e)];
                              ^

t.c:4:1: note: in expansion of macro ‘ASSERT’
 ASSERT((1 << (8*SIZEOF_INT-1)) < 0)
 ^~~~~~


but no mentioning of the signed overflow occuring in 1 << 31 and thus the
non-constant result.

GCC 5 accepts this without complaining.

Reply via email to