Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

VLA test breaks assertion of decl being used without being marked used #30015

Open Quuxplusone opened 7 years ago

Quuxplusone commented 7 years ago
Bugzilla Link PR31042
Status CONFIRMED
Importance P normal
Reported by Paulo Matos (pmatos@linki.tools)
Reported on 2016-11-17 04:01:23 -0800
Last modified on 2017-01-30 17:00:37 -0800
Version trunk
Hardware PC Linux
CC hans@chromium.org, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments vla-15-9b115d-e3f212.c (3462 bytes, text/plain)
vla-15-9b115d-e3f212.sh (1695 bytes, application/x-shellscript)
pr31042.zip (1080 bytes, application/zip)
Blocks
Blocked by
See also
Created attachment 17597
reproducer source

The attached test causes an ice on 4.0.0 nightly. This is extracted from GCC
VLA tests.
Quuxplusone commented 7 years ago

Attached vla-15-9b115d-e3f212.c (3462 bytes, text/plain): reproducer source

Quuxplusone commented 7 years ago

Attached vla-15-9b115d-e3f212.sh (1695 bytes, application/x-shellscript): reproducer script

Quuxplusone commented 7 years ago

Attached pr31042.zip (1080 bytes, application/zip): Minimal reproducer

Quuxplusone commented 7 years ago
After a short discussion on this in the mailing list:
http://lists.llvm.org/pipermail/cfe-dev/2016-November/051579.html

It seems that the problem is that even though we try to special case typeof,
in order for type of to find if it's evaluated it checks the previous context
(in Sema::TransformToPotentiallyEvaluated). If this previous context is
unevaluated then it does not transform the typeof context. When the typeof is
inside a sizeof context, which is unevaluated, typeof is never transformed and
therefore you can't do a sizeof ( typeof ( <vla> )).

I wonder if it's possible for us to mark sizeof as potentially evaluated
instead? What are the downsides of this?
Quuxplusone commented 7 years ago

Created review request https://reviews.llvm.org/D26843

Quuxplusone commented 7 years ago

Reproduces on trunk and 4.0, but also on 3.9 so not strictly a regression.