Bug 101626 - [12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2376
Summary: [12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2376
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: 12.0
Assignee: Eric Botcazou
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2021-07-26 16:45 UTC by G. Steinmetz
Modified: 2021-09-27 22:01 UTC (History)
3 users (show)

See Also:
Host:
Target: x86_64-pc-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-07-27 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description G. Steinmetz 2021-07-26 16:45:50 UTC
Changed between 20210502 and 20210509.
(gcc configured with --enable-checking=yes)

Affects a bunch of testsuite files at -O1+,
e.g. pr36373*.c, pr39120.c, pr50444.c :


$ cat pr39120.c
struct X { int *p; } x;

struct X __attribute__((noinline))
foo(int *p) { struct X x; x.p = p; return x; }

void __attribute((noinline))
bar() { *x.p = 1; }

extern void abort (void);
int main()
{
  int i = 0;
  x = foo(&i);
  bar();
  if (i != 1)
    abort ();
  return 0;
}


$ gcc-12-20210725 -c pr39120.c -O2 -fsso-struct=big-endian
during GIMPLE pass: esra
pr39120.c: In function 'foo':
pr39120.c:18:1: internal compiler error: in verify_sra_access_forest, at tree-sra.c:2376
   18 | }
      | ^
0xee585c verify_sra_access_forest(access*)
        ../../gcc/tree-sra.c:2376
0xee5af1 verify_all_sra_access_forests()
        ../../gcc/tree-sra.c:2420
0xee9d45 analyze_all_variable_accesses
        ../../gcc/tree-sra.c:3480
0xeea7c6 perform_intra_sra
        ../../gcc/tree-sra.c:4564
Comment 1 Martin Jambor 2021-07-27 15:06:09 UTC
Confirmed.  I will have a look (although probably unfortunately only later in August).
Comment 2 Martin Liška 2021-08-03 12:46:43 UTC
Started with r12-622-ge2bc5b6c04df8200.
Comment 3 Eric Botcazou 2021-08-04 17:16:34 UTC
Fixing.
Comment 4 GCC Commits 2021-08-05 08:25:12 UTC
The master branch has been updated by Eric Botcazou <ebotcazou@gcc.gnu.org>:

https://gcc.gnu.org/g:4e3129b0caceec008a940aa5eada253cd0f0b3ec

commit r12-2755-g4e3129b0caceec008a940aa5eada253cd0f0b3ec
Author: Eric Botcazou <ebotcazou@gcc.gnu.org>
Date:   Thu Aug 5 10:21:30 2021 +0200

    Fix oversight in handling of reverse SSO in SRA pass
    
    The scalar storage order does not apply to pointer and vector components.
    
    gcc/
            PR tree-optimization/101626
            * tree-sra.c (propagate_subaccesses_from_rhs): Do not set the
            reverse scalar storage order on a pointer or vector component.
    
    gcc/testsuite/
            * gcc.dg/sso-15.c: New test.
Comment 5 Eric Botcazou 2021-08-05 08:27:13 UTC
Thanks for reporting the problem.