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

            Bug ID: 89569
           Summary: line number is not accurate on large file gcc compared
                    to clang
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jg at jguk dot org
  Target Milestone: ---

Line number not accurate, and not expected wraparound value. Clang shows
expected 3 (it wraps around uint32), GCC shows 270860129


1. Compile cre_test.c
2. run ./cre_line.o >test.c
3. gcc-8 -Wall -o test test.c
4. observe the warning line number incorrect

$ clang-7 -Wall -o test2 test.c
test.c:3:2: warning: msg1 [-W#warnings]


$ gcc-8 -Wall -o test test.c
test.c: In function ‘main’:
test.c:270856150: warning: #warning msg1 [-Wcpp]




// gcc -Wall -o cre_line cre_line.c

#include <stdio.h>

int main()
{
    printf("#include <stdio.h>\nint main() {\n");

    for(size_t i = 0; i != 4294967296; ++i)
    {
        printf("\n");
    }

    printf("#warning msg1\n return 0;");

    return 0;
}

Reply via email to