Red Hat Bugzilla – Bug 196323
g++ gives line number out of range with -pedantic
Last modified: 2007-11-30 17:07:25 EST
Description of problem:
Version-Release number of selected component (if applicable):
g++ (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-52)
Steps to Reproduce:
1. Create a file bug.cpp with the following text:
#line 32768 "test.c"
#line 32767 "test.c"
2. g++ -o -pedantic -Werror test.cpp
bug.cpp:1:7: line number out of range
(plus no .o file is generated due to -Werror)
No error message and generate .o
Apparently g++ requires numbers in line directives to fit in a signed
16-bit number, since 32767 is OK but 32768 is not.
Sorry. Step 2 should have been
2. g++ -o -pedantic -Werror bug.cpp
Please read the standard:
"If the digit sequence specifies zero or a number greater than 32767,
the behavior is undefined."