public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/115641] New: GCC crashes on function has attribute `__attribute__((const))`
@ 2024-06-25 11:58 141242068 at smail dot nju.edu.cn
  2024-06-25 19:55 ` [Bug middle-end/115641] [11/12/13/14/15 Regression] " mpolacek at gcc dot gnu.org
  2024-06-25 19:58 ` mpolacek at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: 141242068 at smail dot nju.edu.cn @ 2024-06-25 11:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115641
           Summary: GCC crashes on function has attribute
                    `__attribute__((const))`
           Product: gcc
           Version: 15.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/79oo9rsxj

When compiling this with `gcc-trunk -O2`, gcc crashes.
This only occurs in trunk version, older versions like gcc-{12,13,14} are
tested to be normal.
```
#include <stdlib.h>

typedef struct {
  char hours, day, month;
  short year;
} T;

T g (void) {
  T now;
  now.hours = 1;
  now.day = 2;
  now.month = 3;
  now.year = 4;
  return now;
}

__attribute__((const)) T f (void)
{
  T virk = g ();
  return virk;
}

int main ()
{
  if (f ().hours != 1 || f ().day != 2 || f ().month != 3 || f ().year != 4)
    abort ();
  return 0;
}
```

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

end of thread, other threads:[~2024-06-25 19:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-25 11:58 [Bug c/115641] New: GCC crashes on function has attribute `__attribute__((const))` 141242068 at smail dot nju.edu.cn
2024-06-25 19:55 ` [Bug middle-end/115641] [11/12/13/14/15 Regression] " mpolacek at gcc dot gnu.org
2024-06-25 19:58 ` mpolacek 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).