[LLVMbugs] [Bug 14987] New: bug handling file info in #line directive in clang?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 17 10:59:25 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=14987

             Bug #: 14987
           Summary: bug handling file info in #line directive in clang?
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: eran_talmorg at yahoo.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


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?

Much thanks,
Eran

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list