llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[DWARF] Line 0 should not have is_stmt set

Open pogo59 opened this issue 9 years ago • 6 comments

Bugzilla Link 34522
Version trunk
OS Windows NT
CC @adrian-prantl,@dwblaikie

Extended Description

I think it does not make sense for a line-0 record to have is_stmt set. I made a point of turning it off for implicit line-0 records generated by DwarfDebug, and in real code I don't think we would ever see it.

However, adding an assertion to this effect broke 40 LLVM tests. In most cases, the problem is merely that the test-input IR does not specify everything that normal IR input has. In particular, at some point DISubprogram started making a distinction between Line and scopeLine, i.e. line of declaration versus where-the-code-starts. If the scopeLine argument is missing from textual IR, it defaults to zero, and that gets propagated to the entry point of the subprogram, which is a stopping point and therefore has is_stmt=1.

Defaulting scopeLine to Line fixed 33 of the tests, and eyeballing the other 7 suggests that most of them don't set Line either. This is (IMO) a matter of flawed tests and it should be no sweat to fix.

There is one test related to prologue-end that seems to be testing that it's okay for prologue-end to be line 0, and I ran out of time to investigate any further.

pogo59 avatar Sep 07 '17 23:09 pogo59

Hi!

This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:

  1. Assign the issue to you.
  2. Fix the issue locally.
  3. Run the test suite locally. 3.1) Remember that the subdirectories under test/ create fine-grained testing targets, so you can e.g. use make check-clang-ast to only run Clang's AST tests.
  4. Create a git commit
  5. Run git clang-format HEAD~1 to format your changes.
  6. Submit the patch to Phabricator. 6.1) Detailed instructions can be found here

For more instructions on how to submit a patch to LLVM, see our documentation.

If you have any further questions about this issue, don't hesitate to ask via a comment on this Github issue.

@llvm/issue-subscribers-good-first-issue

llvmbot avatar Aug 15 '23 16:08 llvmbot

Hello Developers, I am interested in resolving this issue.

jimmy2683 avatar Nov 03 '25 04:11 jimmy2683

@llvm/issue-subscribers-debuginfo

Author: Paul T Robinson (pogo59)

| | | | --- | --- | | Bugzilla Link | [34522](https://llvm.org/bz34522) | | Version | trunk | | OS | Windows NT | | CC | @adrian-prantl,@dwblaikie |

Extended Description

I think it does not make sense for a line-0 record to have is_stmt set. I made a point of turning it off for implicit line-0 records generated by DwarfDebug, and in real code I don't think we would ever see it.

However, adding an assertion to this effect broke 40 LLVM tests. In most cases, the problem is merely that the test-input IR does not specify everything that normal IR input has. In particular, at some point DISubprogram started making a distinction between Line and scopeLine, i.e. line of declaration versus where-the-code-starts. If the scopeLine argument is missing from textual IR, it defaults to zero, and that gets propagated to the entry point of the subprogram, which is a stopping point and therefore has is_stmt=1.

Defaulting scopeLine to Line fixed 33 of the tests, and eyeballing the other 7 suggests that most of them don't set Line either. This is (IMO) a matter of flawed tests and it should be no sweat to fix.

There is one test related to prologue-end that seems to be testing that it's okay for prologue-end to be line 0, and I ran out of time to investigate any further.

llvmbot avatar Nov 03 '25 05:11 llvmbot

Hello Developers, I am interested in resolving this issue.

Please go ahead :)

OCHyams avatar Nov 03 '25 09:11 OCHyams

Hi, this issue is still open, and I would like to work on it.

shrav784 avatar Mar 02 '26 05:03 shrav784

There's an open PR for it, https://github.com/llvm/llvm-project/pull/166627, I've pinged the author there. Probably best to wait a bit and see if they respond.

OCHyams avatar Mar 09 '26 09:03 OCHyams