[Bug preprocessor/60570] New: expression in 'elif' directive mis-diagnosed as error when group will be skipped

2014-03-18 Thread seb.grindle at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60570

Bug ID: 60570
   Summary: expression in 'elif' directive mis-diagnosed as error
when group will be skipped
   Product: gcc
   Version: 4.7.3
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: preprocessor
  Assignee: unassigned at gcc dot gnu.org
  Reporter: seb.grindle at gmail dot com

Consider the following C99 program:

#if 1
int i;
#elif 1/0
#endif

With gcc 4.7.3:

   gcc -c test.c

we get

   test.c:3:8: error: division by zero in #if

According to 6.10.1p5, any sequence of tokens between the #elif and the newline
is valid syntax since the group for which this line is the controlling
condition will be skipped, yet gcc emits a divide by zero error.

(I don't know if this bug is present in later versions as 4.7.3 is the latest I
have tested on.)

Seb


[Bug preprocessor/60570] expression in 'elif' directive mis-diagnosed as error when group will be skipped

2014-03-18 Thread seb.grindle at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60570

--- Comment #2 from seb.grindle at gmail dot com ---
19040 was sort of the opposite. Here we shouldn't get a error but do; there the
report was of the form "this should produce a diagostic but doesn't"