[llvm-bugs] [Bug 40870] New: clang seems limited to uint32 line numbers

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 26 09:26:40 PST 2019


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: unassignedclangbugs at nondot.org
          Reporter: jg at jguk.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190226/9a0472e4/attachment-0001.html>


More information about the llvm-bugs mailing list