This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Fix SARIF column location assertion crash
AbandonedPublic

Authored by Scarlet1ssimo on Feb 12 2023, 3:03 PM.

Details

Reviewers
NoQ
Summary

It meant to fix #60541

LocInfo is 0 based, but column number is 1 based. So in the corner case,
LocInfo.second + 1 == SM.getExpansionColumnNumber(Loc)

Diff Detail

Event Timeline

Scarlet1ssimo created this revision.Feb 12 2023, 3:03 PM
Herald added a project: Restricted Project. · View Herald Transcript
Scarlet1ssimo requested review of this revision.Feb 12 2023, 3:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 12 2023, 3:03 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Looks sensible to me.
Do you have a test for triggering the previous assertion?

Looks sensible to me.
Do you have a test for triggering the previous assertion?

I do have prepared a test case like:

int testA(void) { return 0/0; }
// RUN: %clang_analyze_cc1 -analyzer-checker=core %s -analyzer-output=sarif -o -

Notice you must put the buggy code at the very first line to trigger the assertion.

Do you think it's necessary to put this test case into the test suite?

Looks sensible to me.
Do you have a test for triggering the previous assertion?

I do have prepared a test case like:

int testA(void) { return 0/0; }
// RUN: %clang_analyze_cc1 -analyzer-checker=core %s -analyzer-output=sarif -o -

Notice you must put the buggy code at the very first line to trigger the assertion.

The test passes on main. Are you sure about the reproducer?
I copy-pasted your code as-is into a test file, but check-clang-analysis still passes.

Do you think it's necessary to put this test case into the test suite?

Generally, we only merge changes with tests, but I'm not the one who sets the rules.

Scarlet1ssimo edited the summary of this revision. (Show Details)EditedFeb 12 2023, 11:25 PM

The test passes on main. Are you sure about the reproducer?

This happens on versions from release/10.x to release/15.x. Since 16.x, this file gets refactored and no such problem ever.
I'm new to llvm. Are we still responsible for older versions?

The test passes on main. Are you sure about the reproducer?

This happens on versions from release/10.x to release/15.x. Since 16.x, this file gets refactored and no such problem ever.
I'm new to llvm. Are we still responsible for older versions?

We don't plan to backport a change like this to previous versions.
Thanks for your report and investigation though.

Scarlet1ssimo abandoned this revision.Feb 12 2023, 11:39 PM