This is an archive of the discontinued LLVM Phabricator instance.

[Clang] Fix variant crashes from GH58028, GH57370
ClosedPublic

Authored by royjacobson on Sep 29 2022, 8:40 AM.

Diff Detail

Event Timeline

royjacobson created this revision.Sep 29 2022, 8:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 29 2022, 8:40 AM
royjacobson requested review of this revision.Sep 29 2022, 8:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 29 2022, 8:40 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Rebase on main (build was broken)

shafik accepted this revision.Sep 29 2022, 4:35 PM

LFTM besides the comment about the test.

clang/test/SemaCXX/specialization-diagnose-crash.cpp
3

Shouldn't we see a diagnostic in order to exercise the code that is being fixed?

This revision is now accepted and ready to land.Sep 29 2022, 4:35 PM

Slightly modify the test

royjacobson marked an inline comment as done.Sep 30 2022, 1:08 AM
royjacobson added inline comments.
clang/test/SemaCXX/specialization-diagnose-crash.cpp
3

Since this fixes an ICE I'm not sure we actually need to, but I modified it a bit so we have assurance that the specialization code runs.

This revision was landed with ongoing or failed builds.Sep 30 2022, 1:09 AM
This revision was automatically updated to reflect the committed changes.
royjacobson marked an inline comment as done.
royjacobson reopened this revision.Sep 30 2022, 1:59 AM

Apparently some of the workers crashed with the test - https://lab.llvm.org/buildbot/#/builders/216/builds/10556, but I couldn't reproduce this locally. @shafik any idea why the diagnostics might change? :/

This revision is now accepted and ready to land.Sep 30 2022, 1:59 AM

Apparently some of the workers crashed with the test - https://lab.llvm.org/buildbot/#/builders/216/builds/10556, but I couldn't reproduce this locally. @shafik any idea why the diagnostics might change? :/

I have no idea where that warning comes from. That shouldn't happen on ANY machine, since it is a public member (a is), not a private one (which should cause the diagnostic). Is that the only bot with this problem?

I don't know what the 'sie' build is... but it gets me wondering if that diagnostic is getting an uninitialized version of "VerifyOnly" somewhere? It seems to me that it should be suppressing that diagnostic (if that is what VerifyOnly means here?)?

It IS bizarre to me that this crash would be noticed by something that DIDN'T try to evaluate that diagnostic though, since the ICE is on that code path.

Apparently some of the workers crashed with the test - https://lab.llvm.org/buildbot/#/builders/216/builds/10556, but I couldn't reproduce this locally. @shafik any idea why the diagnostics might change? :/

I have no idea where that warning comes from. That shouldn't happen on ANY machine, since it is a public member (a is), not a private one (which should cause the diagnostic). Is that the only bot with this problem?

I don't know what the 'sie' build is... but it gets me wondering if that diagnostic is getting an uninitialized version of "VerifyOnly" somewhere? It seems to me that it should be suppressing that diagnostic (if that is what VerifyOnly means here?)?

It IS bizarre to me that this crash would be noticed by something that DIDN'T try to evaluate that diagnostic though, since the ICE is on that code path.

Hmmm, uninitialized access might explain why it's runner dependent. I'll try and see if I can run it through USan.

Only thing I can think of is the 'Aggregate' calculation for this diagnostic is going wrong somewhere. See SemaDeclcXX.cpp ~6759 for where this all happens.

Aggregate IS initialized correctly to 'true' in CXXRecordDecl's DefinitionData as far as I can tell. BUT I can't imagine that some sort of optimization or mis-initialization of aggregate wouldn't cause some significant problems elsewhere. I'm thoroughly confused.

Apparently some of the workers crashed with the test - https://lab.llvm.org/buildbot/#/builders/216/builds/10556, but I couldn't reproduce this locally. @shafik any idea why the diagnostics might change? :/

I can't see what is going on here either. It looks like this is a windows PS5 bot. If you have access to a windows machine it might be worth trying a windows release w/ asserts build to see if it reproduces there.

Apparently some of the workers crashed with the test - https://lab.llvm.org/buildbot/#/builders/216/builds/10556, but I couldn't reproduce this locally. @shafik any idea why the diagnostics might change? :/

I can't see what is going on here either. It looks like this is a windows PS5 bot. If you have access to a windows machine it might be worth trying a windows release w/ asserts build to see if it reproduces there.

Ahhh, that exaplains it. The PlayStation targets didn't switch their default standard version to C++17, and using --std=c++14 will indeed reproduce the warnings. Some C++17 aggregate initialization changes, I guess. Thank you!

Lock the test to standard version

Apparently some of the workers crashed with the test - https://lab.llvm.org/buildbot/#/builders/216/builds/10556, but I couldn't reproduce this locally. @shafik any idea why the diagnostics might change? :/

I can't see what is going on here either. It looks like this is a windows PS5 bot. If you have access to a windows machine it might be worth trying a windows release w/ asserts build to see if it reproduces there.

Ahhh, that exaplains it. The PlayStation targets didn't switch their default standard version to C++17, and using --std=c++14 will indeed reproduce the warnings. Some C++17 aggregate initialization changes, I guess. Thank you!

Hah, wow! Good catch! I'd not known about the PS not changing defaults, but I DID have the DeclCXX.cpp 'setBases' function up on my screen that set that aggregate and was like, "huh... this is interesting, but I don't see how that applies here".

This revision was automatically updated to reflect the committed changes.