[cfe-users] bug handling #line directive in clang?

Dmitri Gribenko gribozavr at gmail.com
Thu Jan 17 09:40:14 PST 2013


On Mon, Jan 14, 2013 at 2:46 PM, Eran Talmor <the.eran.talmor at gmail.com> wrote:
> Hello,
>
> I am observing a weird behavior in clang, inconsistent with gcc.
> Consider the following file (bug.c):
>
>
> extern int x;
> int main()
> {
> #line 10 "foo.c"
>   {
> #line 100 "bug.c"
>     int y=0;
>   }
>   ++x;
>   return 0;
> }
>
>
> Obviously building it fails in the linking stage, as "x" is undefined.
> That's fine.
> The problem is that clang reports the "++x" coming from a wrong file.
> I expected to see the report on "bug.c", line 102.
> However, clang reports it on "foo.c", line 102.
> i.e. in the last #line pragma (#line 100 "bug.c") it used the line
> information "100", but ignored the file information "bug.c"
>
> Here's the command line I used:
>
> clang -g bug.c -o bug.out
>
>
> And this is the output it produced:
>
> /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld:
> Dwarf Error: Invalid or unhandled FORM value: 25.
> /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld:
> Dwarf Error: Invalid or unhandled FORM value: 25.
> /tmp/bug-4lmk6q.o: In function `main':
> ..../foo.c:102: undefined reference to `x'
> ..../foo.c:102: undefined reference to `x'
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
>
> I observed this on the on version 3.1, 3.2 and the latest code from the
> trunk.
> Any ideas?

Please file a bug report, http://llvm.org/bugs/

Thank you.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-users mailing list