LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 36420 - Clang does not generate DW_TAG_label
Summary: Clang does not generate DW_TAG_label
Status: NEW
Alias: None
Product: new-bugs
Classification: Unclassified
Component: new bugs (show other bugs)
Version: trunk
Hardware: Macintosh All
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-17 10:15 PST by Jonas Devlieghere
Modified: 2018-02-19 08:05 PST (History)
5 users (show)

See Also:
Fixed By Commit(s):


Attachments
llvm-dwarfdump output for clang binary (2.03 KB, text/plain)
2018-02-17 10:16 PST, Jonas Devlieghere
Details
llvm-dwarfdump output for gcc binary (2.41 KB, text/plain)
2018-02-17 10:17 PST, Jonas Devlieghere
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonas Devlieghere 2018-02-17 10:15:49 PST
clang does not generate a DW_TAG_label for the example below, while gcc does:

int main(int argc, char** argv)
{
  goto failure;
failure:
  return 1;
}
Comment 1 Jonas Devlieghere 2018-02-17 10:16:25 PST
Created attachment 19885 [details]
llvm-dwarfdump output for clang binary
Comment 2 Jonas Devlieghere 2018-02-17 10:17:00 PST
Created attachment 19886 [details]
llvm-dwarfdump output for gcc binary
Comment 3 Jonas Devlieghere 2018-02-18 04:48:52 PST
I tried bisecting this but couldn't find any passing builds. Did we ever generate this TAG?
Comment 4 Adrian Prantl 2018-02-19 07:51:17 PST
I have only ever seen DW_TAG_label being generated for assembler sources. In assembler there is no notion of a function, only labels.
Comment 5 Adrian Prantl 2018-02-19 07:51:57 PST
Do you think generating a DW_TAG_label for C-language labels would be useful?
Comment 6 Jonas Devlieghere 2018-02-19 08:00:03 PST
I'd like to say yes, assuming that it's a prerequisite to be able to break on labels in the debugger. I don't know if LLDB supports this, but I'm pretty sure GDB does.
Comment 7 Adrian Prantl 2018-02-19 08:05:28 PST
Is it possible to distinguish user-specified labels from compiler-generated ones in LLVM IR and MIR? If yes, then this should be fairly straightforward to implement in AsmPrinter.