https://bugs.llvm.org/show_bug.cgi?id=40870

            Bug ID: 40870
           Summary: clang seems limited to uint32 line numbers
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: j...@jguk.org
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

Two parts of #line numbers have an issue. So I am filing together.

1) clang seems limited to uint32 line numbers
and then wraparound back to 0 even !
I know many people won't ever encounter this, but good to define it.

Better to change it to 64bit?

If there must be a limit, better to change "directive requires a positive
integer argument" to show the limit


Also better to fix it on the line limit?  4294967295

ie ""directive requires a positive integer argument 1 - 4294967295" 


2) #line 0 is not allowed by C spec, but Clang allows it

int main(void)
{
        #line 0
    #warning msg1
}




from godbolt.org

#1 with x86-64 clang (trunk)
<source>:4294967295:6: warning: msg1 [-W#warnings]
    #warning msg1
     ^
<source>:0:8: error: #line directive requires a positive integer argument
        #line 4294967296
              ^
<source>:1:6: warning: msg2 [-W#warnings]
    #warning msg2
     ^
2 warnings and 1 error generated.

Compiler returned: 1



int main(void)
{
        #line 4294967295
    #warning msg1
        #line 4294967296
    #warning msg2
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to