[Bug c/28768] New: Preprocessor doesn't parse tokens correctly?

beethoven3322 at hotmail dot com gcc-bugzilla@gcc.gnu.org
Fri Aug 18 05:07:00 GMT 2006


The following C program will not compile with the command "gcc file.c":

#define FIRST "This is a split
int main() {
   printf( FIRST string");
}

It gives the expected error message about the malformed preprocessor token.
However if the output of "cpp file.c" or "gcc -E file.c" is saved and fed back
into gcc then it DOES compile and run. Here is the output of "gcc -E file.c":

int main() {
   printf( "This is a split string");
}

I checked the ANSI standard and this is indeed an illegal program. Shouldn't
the preprocessor give an error message when run alone?


-- 
           Summary: Preprocessor doesn't parse tokens correctly?
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: beethoven3322 at hotmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28768



More information about the Gcc-bugs mailing list