public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/111278] New: error: call to ‘...’ declared with attribute error: code path is reachable with -Og, but not -O2
@ 2023-09-03 19:49 sjames at gcc dot gnu.org
  2023-09-03 19:52 ` [Bug middle-end/111278] " sjames at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-09-03 19:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111278
           Summary: error: call to ‘...’ declared with attribute error:
                    code path is reachable with -Og, but not -O2
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

Created attachment 55835
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55835&action=edit
accel_tcg_cputlb.c.i

Upstream QEMU say this is a compiler bug:
* https://gitlab.com/qemu-project/qemu/-/issues/1848
* https://gitlab.com/qemu-project/qemu/-/issues/1848#note_1540675831

Original report was downstream in Gentoo at https://bugs.gentoo.org/913083.

It builds fine with -O2, but fails with -Og:
```
$ gcc -m64 -mcx16 -O2 -Werror=implicit -Werror=return-type -c
accel_tcg_cputlb.c.i -march=amdfam10

$ gcc -m64 -mcx16 -Og -Werror=implicit -Werror=return-type -c
accel_tcg_cputlb.c.i -march=amdfam10
../accel/tcg/cputlb.c: In function ‘do_ld_mmio_beN’:
../accel/tcg/cputlb.c:2121:13: error: call to ‘qemu_build_not_reached_always’
declared with attribute error: code path is reachable
../accel/tcg/cputlb.c: In function ‘do_st_mmio_leN’:
../accel/tcg/cputlb.c:2764:13: error: call to ‘qemu_build_not_reached_always’
declared with attribute error: code path is reachable
```

This is with 13.2.1 20230902, not tried other versions yet except trunk which
also failed (14.0.0 20230827).

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

* [Bug middle-end/111278] error: call to ‘...’ declared with attribute error: code path is reachable with -Og, but not -O2
  2023-09-03 19:49 [Bug middle-end/111278] New: error: call to ‘...’ declared with attribute error: code path is reachable with -Og, but not -O2 sjames at gcc dot gnu.org
@ 2023-09-03 19:52 ` sjames at gcc dot gnu.org
  2023-09-03 19:55 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-09-03 19:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
10/11/12/13/14 all seem to fail

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

* [Bug middle-end/111278] error: call to ‘...’ declared with attribute error: code path is reachable with -Og, but not -O2
  2023-09-03 19:49 [Bug middle-end/111278] New: error: call to ‘...’ declared with attribute error: code path is reachable with -Og, but not -O2 sjames at gcc dot gnu.org
  2023-09-03 19:52 ` [Bug middle-end/111278] " sjames at gcc dot gnu.org
@ 2023-09-03 19:55 ` pinskia at gcc dot gnu.org
  2023-09-03 19:56 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-03 19:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
do_ld_mmio_beN (and do_st_mmio_leN) are not declared as always_inline so it
does not need to be inlined and then the switch there will not be optimized
away.

Also do_ld_mmio_beN really requires full optimization to optimize out that
switch too.

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

* [Bug middle-end/111278] error: call to ‘...’ declared with attribute error: code path is reachable with -Og, but not -O2
  2023-09-03 19:49 [Bug middle-end/111278] New: error: call to ‘...’ declared with attribute error: code path is reachable with -Og, but not -O2 sjames at gcc dot gnu.org
  2023-09-03 19:52 ` [Bug middle-end/111278] " sjames at gcc dot gnu.org
  2023-09-03 19:55 ` pinskia at gcc dot gnu.org
@ 2023-09-03 19:56 ` pinskia at gcc dot gnu.org
  2023-09-03 19:59 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-03 19:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |---

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
-O1 will also fail.

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

* [Bug middle-end/111278] error: call to ‘...’ declared with attribute error: code path is reachable with -Og, but not -O2
  2023-09-03 19:49 [Bug middle-end/111278] New: error: call to ‘...’ declared with attribute error: code path is reachable with -Og, but not -O2 sjames at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-09-03 19:56 ` pinskia at gcc dot gnu.org
@ 2023-09-03 19:59 ` pinskia at gcc dot gnu.org
  2023-09-03 20:43 ` sjames at gcc dot gnu.org
  2023-09-12 10:50 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-03 19:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |82738

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Oh -O0 will also fail.

I suspect this case will just be declared as not to be fixed.
the type for the switch is still int but the range is [0,7] and we don't do as
much optimizations for -Og.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82738
[Bug 82738] [meta-bug] issues with the -Og optimization level

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

* [Bug middle-end/111278] error: call to ‘...’ declared with attribute error: code path is reachable with -Og, but not -O2
  2023-09-03 19:49 [Bug middle-end/111278] New: error: call to ‘...’ declared with attribute error: code path is reachable with -Og, but not -O2 sjames at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-09-03 19:59 ` pinskia at gcc dot gnu.org
@ 2023-09-03 20:43 ` sjames at gcc dot gnu.org
  2023-09-12 10:50 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-09-03 20:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Sam James <sjames at gcc dot gnu.org> ---
Created attachment 55836
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55836&action=edit
reduced.i

Clang seems to fail to build this reduced one with -O0 too, although -O1/-Og
are ok there.

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

* [Bug middle-end/111278] error: call to ‘...’ declared with attribute error: code path is reachable with -Og, but not -O2
  2023-09-03 19:49 [Bug middle-end/111278] New: error: call to ‘...’ declared with attribute error: code path is reachable with -Og, but not -O2 sjames at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-09-03 20:43 ` sjames at gcc dot gnu.org
@ 2023-09-12 10:50 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-09-12 10:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Indeed I think the expectation is wrong.

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

end of thread, other threads:[~2023-09-12 10:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-03 19:49 [Bug middle-end/111278] New: error: call to ‘...’ declared with attribute error: code path is reachable with -Og, but not -O2 sjames at gcc dot gnu.org
2023-09-03 19:52 ` [Bug middle-end/111278] " sjames at gcc dot gnu.org
2023-09-03 19:55 ` pinskia at gcc dot gnu.org
2023-09-03 19:56 ` pinskia at gcc dot gnu.org
2023-09-03 19:59 ` pinskia at gcc dot gnu.org
2023-09-03 20:43 ` sjames at gcc dot gnu.org
2023-09-12 10:50 ` rguenth 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).