public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/112493] New: GCC: 14: internal compiler error: in verify_sra_access_forest, at tree-sra.cc:2421
@ 2023-11-12 14:13 141242068 at smail dot nju.edu.cn
  2023-11-12 16:19 ` [Bug tree-optimization/112493] [11/12/13/14 Regression] ICE in verify_sra_access_forest with scalar_storage_order pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: 141242068 at smail dot nju.edu.cn @ 2023-11-12 14:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112493

            Bug ID: 112493
           Summary: GCC: 14: internal compiler error: in
                    verify_sra_access_forest, at tree-sra.cc:2421
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 141242068 at smail dot nju.edu.cn
  Target Milestone: ---

Compiler Explorer: https://gcc.godbolt.org/z/971ccPba8

When tries to compile this program with `gcc-14 -O1`, gcc throws internal
compiler error:
```
#define BIG_ENDIAN \
  __attribute__((scalar_storage_order("big-endian")))

typedef struct {
  union {
    char addr8[16];
  } u;
} ip6_addr_t;

typedef struct {
  char is_v4;
  union {
    int addr;
    ip6_addr_t addr6;
  } u;
} net_addr_t;

typedef struct {
  union {
    char addr8[16];
  } u;
} be_ip6_addr_t;

typedef struct {
  char is_v4;
  union {
    be_ip6_addr_t addr6;
    char addr;
  } BIG_ENDIAN u;
} BIG_ENDIAN be_net_addr_t;

struct T {
  const net_addr_t ip;
  be_ip6_addr_t rc;
} v;

be_ip6_addr_t be_ip6_addr(const ip6_addr_t ip6) {
  return v.rc;
}

be_net_addr_t be_net_addr(const net_addr_t ip) {
  be_net_addr_t rc;
  if (v.ip.is_v4) {
    rc.u.addr = v.ip.u.addr;
  } else {
    rc.u.addr6 = be_ip6_addr(v.ip.u.addr6);
  }
  return rc;
}
```

The crash output:
```
<source>:27:19: warning: type punning toggles scalar storage order
[-Wscalar-storage-order]
   27 |     be_ip6_addr_t addr6;
      |                   ^~~~~
during GIMPLE pass: sra
<source>: In function 'be_net_addr':
<source>:41:15: internal compiler error: in verify_sra_access_forest, at
tree-sra.cc:2421
   41 | be_net_addr_t be_net_addr(const net_addr_t ip) {
      |               ^~~~~~~~~~~
0x238b15e internal_error(char const*, ...)
        ???:0
0xa11270 fancy_abort(char const*, int, char const*)
        ???:0
0x1226f82 verify_all_sra_access_forests()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/112493] [11/12/13/14 Regression] ICE in verify_sra_access_forest with scalar_storage_order
  2023-11-12 14:13 [Bug c/112493] New: GCC: 14: internal compiler error: in verify_sra_access_forest, at tree-sra.cc:2421 141242068 at smail dot nju.edu.cn
@ 2023-11-12 16:19 ` pinskia at gcc dot gnu.org
  2023-11-13  9:01 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-12 16:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112493

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |tree-optimization
           Keywords|                            |ice-on-valid-code,
                   |                            |needs-bisection
            Summary|GCC: 14: internal compiler  |[11/12/13/14 Regression]
                   |error: in                   |ICE in
                   |verify_sra_access_forest,   |verify_sra_access_forest
                   |at tree-sra.cc:2421         |with scalar_storage_order
   Last reconfirmed|                            |2023-11-12
      Known to fail|                            |10.1.0, 12.1.0
   Target Milestone|---                         |11.5
      Known to work|                            |9.5.0
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/112493] [11/12/13/14 Regression] ICE in verify_sra_access_forest with scalar_storage_order
  2023-11-12 14:13 [Bug c/112493] New: GCC: 14: internal compiler error: in verify_sra_access_forest, at tree-sra.cc:2421 141242068 at smail dot nju.edu.cn
  2023-11-12 16:19 ` [Bug tree-optimization/112493] [11/12/13/14 Regression] ICE in verify_sra_access_forest with scalar_storage_order pinskia at gcc dot gnu.org
@ 2023-11-13  9:01 ` rguenth at gcc dot gnu.org
  2023-11-13 10:38 ` ebotcazou at gcc dot gnu.org
  2024-04-14  6:34 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-13  9:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112493

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu.org,
                   |                            |jamborm at gcc dot gnu.org
           Priority|P3                          |P2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/112493] [11/12/13/14 Regression] ICE in verify_sra_access_forest with scalar_storage_order
  2023-11-12 14:13 [Bug c/112493] New: GCC: 14: internal compiler error: in verify_sra_access_forest, at tree-sra.cc:2421 141242068 at smail dot nju.edu.cn
  2023-11-12 16:19 ` [Bug tree-optimization/112493] [11/12/13/14 Regression] ICE in verify_sra_access_forest with scalar_storage_order pinskia at gcc dot gnu.org
  2023-11-13  9:01 ` rguenth at gcc dot gnu.org
@ 2023-11-13 10:38 ` ebotcazou at gcc dot gnu.org
  2024-04-14  6:34 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2023-11-13 10:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112493

--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Of course the compiler should not ICE, but the code will not work as intended
in  any case, see the warning issued by the compiler about the unsupported type
punning.  If you want to byte-swap data, use the __builtin_bswapnn functions.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/112493] [11/12/13/14 Regression] ICE in verify_sra_access_forest with scalar_storage_order
  2023-11-12 14:13 [Bug c/112493] New: GCC: 14: internal compiler error: in verify_sra_access_forest, at tree-sra.cc:2421 141242068 at smail dot nju.edu.cn
                   ` (2 preceding siblings ...)
  2023-11-13 10:38 ` ebotcazou at gcc dot gnu.org
@ 2024-04-14  6:34 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-14  6:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112493

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
      gcc_assert (reverse == access->reverse);

Oh the verification was added with r10-6320-g5b9e89c922dc2e . So there is no
reason to do a bisect either. Lucky this is with checking enabled so most folks
are not running into this.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-14  6:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-12 14:13 [Bug c/112493] New: GCC: 14: internal compiler error: in verify_sra_access_forest, at tree-sra.cc:2421 141242068 at smail dot nju.edu.cn
2023-11-12 16:19 ` [Bug tree-optimization/112493] [11/12/13/14 Regression] ICE in verify_sra_access_forest with scalar_storage_order pinskia at gcc dot gnu.org
2023-11-13  9:01 ` rguenth at gcc dot gnu.org
2023-11-13 10:38 ` ebotcazou at gcc dot gnu.org
2024-04-14  6:34 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).