[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 Jakub Jelinek changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED Target Milestone|--- |7.5 --- Comment #15 from Jakub Jelinek --- Fixed.
[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 --- Comment #14 from Jakub Jelinek --- Author: jakub Date: Fri Aug 30 12:08:04 2019 New Revision: 275117 URL: https://gcc.gnu.org/viewcvs?rev=275117=gcc=rev Log: Backported from mainline 2019-02-20 Jakub Jelinek David Malcolm PR middle-end/89091 * fold-const.c (decode_field_reference): Return NULL_TREE if lang_hooks.types.type_for_size returns NULL. Check it before overwriting *exp_. Use return NULL_TREE instead of return 0. * gcc.dg/torture/pr89091.c: New test. Added: branches/gcc-7-branch/gcc/testsuite/gcc.dg/torture/pr89091.c Modified: branches/gcc-7-branch/gcc/ChangeLog branches/gcc-7-branch/gcc/fold-const.c branches/gcc-7-branch/gcc/testsuite/ChangeLog
[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 Jakub Jelinek changed: What|Removed |Added Known to work||8.3.1 --- Comment #13 from Jakub Jelinek --- Fixed for 8.4+ too.
[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 --- Comment #12 from Jakub Jelinek --- Author: jakub Date: Tue Apr 30 20:29:44 2019 New Revision: 270713 URL: https://gcc.gnu.org/viewcvs?rev=270713=gcc=rev Log: Backported from mainline 2019-02-20 Jakub Jelinek David Malcolm PR middle-end/89091 * fold-const.c (decode_field_reference): Return NULL_TREE if lang_hooks.types.type_for_size returns NULL. Check it before overwriting *exp_. Use return NULL_TREE instead of return 0. * gcc.dg/torture/pr89091.c: New test. Added: branches/gcc-8-branch/gcc/testsuite/gcc.dg/torture/pr89091.c Modified: branches/gcc-8-branch/gcc/ChangeLog branches/gcc-8-branch/gcc/fold-const.c branches/gcc-8-branch/gcc/testsuite/ChangeLog
[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 --- Comment #11 from Jakub Jelinek --- (In reply to Jakub Jelinek from comment #8) > Well, for the decode_field_reference, I think it is essential not to change > *exp_ if returning NULL, because the caller uses lr_arg/rr_arg without > checking whether it returned NULL or not. The c_common_type_for_size change > is independent of the rest, I'd find it too risky for GCC9, but could be > posted for GCC10. David, are you going to submit this c_common_type_for_size change for GCC 10?
[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 --- Comment #10 from Jakub Jelinek --- Fixed for 9+ so far.
[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 --- Comment #9 from Jakub Jelinek --- Author: jakub Date: Wed Feb 20 23:01:41 2019 New Revision: 269056 URL: https://gcc.gnu.org/viewcvs?rev=269056=gcc=rev Log: PR middle-end/89091 * fold-const.c (decode_field_reference): Return NULL_TREE if lang_hooks.types.type_for_size returns NULL. Check it before overwriting *exp_. Use return NULL_TREE instead of return 0. * gcc.dg/torture/pr89091.c: New test. Added: trunk/gcc/testsuite/gcc.dg/torture/pr89091.c Modified: trunk/gcc/ChangeLog trunk/gcc/fold-const.c trunk/gcc/testsuite/ChangeLog
[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 --- Comment #8 from Jakub Jelinek --- Comment on attachment 45774 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45774 Patch Well, for the decode_field_reference, I think it is essential not to change *exp_ if returning NULL, because the caller uses lr_arg/rr_arg without checking whether it returned NULL or not. The c_common_type_for_size change is independent of the rest, I'd find it too risky for GCC9, but could be posted for GCC10. Sorry for looking on this, I saw you have it ASSIGNED but didn't see any patch on gcc-patches nor recent progress in the PR and thought some input might help.
[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 --- Comment #6 from David Malcolm --- Created attachment 45774 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45774=edit Patch I came up with this patch; it survives bootstrap, but am not sure if it's correct.
[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 David Malcolm changed: What|Removed |Added Status|ASSIGNED|NEW Assignee|dmalcolm at gcc dot gnu.org|unassigned at gcc dot gnu.org --- Comment #7 from David Malcolm --- Jakub: should we go with your patch?
[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek --- Created attachment 45773 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45773=edit gcc9-pr89091.patch I'd just return NULL in that case. While in theory we could just build_nonstandard_integer_type or similar, I think for these > 64 bit bitfields it will be hardly a win and we'd need to ensure the backend will be able to deal with those types.
[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 --- Comment #4 from Arseny Solokha --- (In reply to David Binderman from comment #3) > for gcc/testsuite/gcc.dg/pr89037.c, valgrind says: That's where I've minimized my testcase from.
[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 --- Comment #3 from David Binderman --- for gcc/testsuite/gcc.dg/pr89037.c, valgrind says: ./gcc.dg/pr89037.c:9:9: warning: missing braces around initializer [-Wmissing-braces] 9 | T a[] = { 1, 1, 0x12345, 0xff01, 1ULL << 63, (__int128) 1 << 64, | ^ | {} {} { } { } { } { } 10 |((__int128) 1 << 64) | 1 }; |{} ==11913== Invalid read of size 2 ==11913==at 0x7F5B96: decode_field_reference(unsigned int, tree_node**, long*, long*, machine_mode*, int*, int*, int*, tree_node**, tree_node**) (fold-const.c:4327)
[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 --- Comment #2 from Martin Liška --- Any update on this David?
[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 David Malcolm changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |dmalcolm at gcc dot gnu.org
[Bug middle-end/89091] ICE: Segmentation fault (in tree_class_check)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89091 David Malcolm changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2019-01-28 CC||dmalcolm at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from David Malcolm --- Confirmed, at -O1 and above. Segfaults reading through NULL "unsigned_type" here in decode_field_reference: 4325 /* Compute the mask to access the bitfield. */ 4326 unsigned_type = lang_hooks.types.type_for_size (*pbitsize, 1); 4327 precision = TYPE_PRECISION (unsigned_type);