[Bug preprocessor/69391] New: Incorrect __LINE__ expansion with -ftrack-macro-expansion=0

mail at bobah dot net gcc-bugzilla@gcc.gnu.org
Wed Jan 20 16:24:00 GMT 2016


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

            Bug ID: 69391
           Summary: Incorrect __LINE__ expansion with
                    -ftrack-macro-expansion=0
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mail at bobah dot net
  Target Milestone: ---

The below test program
- incorrectly prints "83" on g++ 5.2 with '-ftrack-macro-expansion=0'
- correctly prints "88" on g++ 5.2 with '-ftrack-macro-expansion=1'
- correctly prints "88" on g++ 4.9 regardless of '-ftrack-macro-expansion' flag

#define STR_I(X) #X
#define STR(X) STR_I(X)
#define LINE STR(__LINE__) STR(__LINE__)

#include <iostream>
int main()
{
    std::cout << LINE << "\n";
    return 0;
}


More information about the Gcc-bugs mailing list