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

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).