Page MenuHomePhabricator

Fix ICE on attempt to add an addr space qual to a type qualified by an addr space

Authored by Anastasia on Jan 31 2019, 9:42 AM.



If cv2T2 has an address space and we are creating a qualified type cv1T4 adding new addr space qualifier an ICE is triggered.

To avoid this ICE we first create a duplicate of cv2T2 omitting its original addr space. Then we can safely use it to create combined type to use in the conversion.

This is the last patch that allows fixing PR38614!

Diff Detail

rC Clang

Event Timeline

Anastasia created this revision.Jan 31 2019, 9:42 AM
rjmccall added inline comments.Jan 31 2019, 10:55 AM

Qualifiers::addQualifiers should let you do this in a single step. Also, you seem to be modifying T2Quals here after the last use of it.

Anastasia marked an inline comment as done.Feb 1 2019, 3:25 AM
Anastasia added inline comments.

Ok, I will update to use Qualifies methods directly.

As for T2Quals I was thinking it might make sense to restore the original value in case some code later will be added to use it (to prevent bugs)... but may be it's too hypothetical. :)


rjmccall added inline comments.Feb 1 2019, 9:06 AM

That's not unreasonable, but if you're going to do that, you should do it unconditionally, not just in a AS1 != AS2 block — or better yet, make new locals for T1QualsWithoutAS.

Anastasia updated this revision to Diff 185024.Feb 4 2019, 4:04 AM
  • Renamed variables and made other changes to improve readability.
rjmccall accepted this revision.Feb 4 2019, 11:44 AM


This revision is now accepted and ready to land.Feb 4 2019, 11:44 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 5 2019, 3:32 AM