public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112938] New: ice with -fstrub=internal
@ 2023-12-09 11:45 dcb314 at hotmail dot com
  2023-12-09 11:48 ` [Bug c++/112938] " dcb314 at hotmail dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: dcb314 at hotmail dot com @ 2023-12-09 11:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112938
           Summary: ice with -fstrub=internal
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Created attachment 56839
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56839&action=edit
C++ source code

foundBugs $ ~/gcc/results/bin/gcc -c -w bug988.cc
foundBugs $ ~/gcc/results/bin/gcc -c -w -fstrub=internal bug988.cc
bt2_locks.cpp: In member function ‘void mcs_lock::spin_while_eq(const volatile
std::atomic_bool&, bool)’:
bt2_locks.cpp:36:1: error: invalid operand in unary operation
# VUSE <.MEM_1(D)>
arg.61_2 ={v} (int) expected;
during IPA pass: strub
bt2_locks.cpp:36:1: internal compiler error: verify_gimple failed
0x120d053 verify_gimple_in_cfg(function*, bool, bool)
        ../../trunk.year/gcc/tree-cfg.cc:5666
0x107bc9a execute_function_todo(function*, void*)
        ../../trunk.year/gcc/passes.cc:2088

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

* [Bug c++/112938] ice with -fstrub=internal
  2023-12-09 11:45 [Bug c++/112938] New: ice with -fstrub=internal dcb314 at hotmail dot com
@ 2023-12-09 11:48 ` dcb314 at hotmail dot com
  2023-12-09 20:17 ` [Bug middle-end/112938] " pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dcb314 at hotmail dot com @ 2023-12-09 11:48 UTC (permalink / raw)
  To: gcc-bugs

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

David Binderman <dcb314 at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aoliva at gcc dot gnu.org

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
Reduced C++ code seems to be:

struct mcs_lock {
  void lock();
  void spin_while_eq(volatile bool) {}
};
void mcs_lock::lock() { spin_while_eq(false); }

Adding the feature author for their opinion.

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

* [Bug middle-end/112938] ice with -fstrub=internal
  2023-12-09 11:45 [Bug c++/112938] New: ice with -fstrub=internal dcb314 at hotmail dot com
  2023-12-09 11:48 ` [Bug c++/112938] " dcb314 at hotmail dot com
@ 2023-12-09 20:17 ` pinskia at gcc dot gnu.org
  2023-12-11 16:25 ` aoliva at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-09 20:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=48274,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=112877
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-12-09
     Ever confirmed|0                           |1
             Target|                            |x86_64-linux-gnu

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced C testcase:
```
void f(volatile short) {}
void g() { f(0); }
```

The problem happens on x86_64 and not aarch64 due to TARGET_PROMOTE_PROTOTYPES
macro.

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

* [Bug middle-end/112938] ice with -fstrub=internal
  2023-12-09 11:45 [Bug c++/112938] New: ice with -fstrub=internal dcb314 at hotmail dot com
  2023-12-09 11:48 ` [Bug c++/112938] " dcb314 at hotmail dot com
  2023-12-09 20:17 ` [Bug middle-end/112938] " pinskia at gcc dot gnu.org
@ 2023-12-11 16:25 ` aoliva at gcc dot gnu.org
  2023-12-12  2:13 ` aoliva at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2023-12-11 16:25 UTC (permalink / raw)
  To: gcc-bugs

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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |aoliva at gcc dot gnu.org

--- Comment #3 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Mine, thanks for the report, and for the reduced testcases!

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

* [Bug middle-end/112938] ice with -fstrub=internal
  2023-12-09 11:45 [Bug c++/112938] New: ice with -fstrub=internal dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2023-12-11 16:25 ` aoliva at gcc dot gnu.org
@ 2023-12-12  2:13 ` aoliva at gcc dot gnu.org
  2023-12-14 13:41 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2023-12-12  2:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Patch at https://gcc.gnu.org/pipermail/gcc-patches/2023-December/640252.html

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

* [Bug middle-end/112938] ice with -fstrub=internal
  2023-12-09 11:45 [Bug c++/112938] New: ice with -fstrub=internal dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2023-12-12  2:13 ` aoliva at gcc dot gnu.org
@ 2023-12-14 13:41 ` cvs-commit at gcc dot gnu.org
  2023-12-14 13:41 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-14 13:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aoliva@gcc.gnu.org>:

https://gcc.gnu.org/g:37afeec8a635153ccd4e91bd686c93217706894d

commit r14-6546-g37afeec8a635153ccd4e91bd686c93217706894d
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Thu Dec 14 10:41:13 2023 -0300

    strub: handle volatile promoted args in internal strub [PR112938]

    When generating code for an internal strub wrapper, don't clear the
    DECL_NOT_GIMPLE_REG_P flag of volatile args, and gimplify them both
    before and after any conversion.

    While at that, move variable TMP into narrower scopes so that it's
    more trivial to track where ARG lives.


    for  gcc/ChangeLog

            PR middle-end/112938
            * ipa-strub.cc (pass_ipa_strub::execute): Handle promoted
            volatile args in internal strub.  Simplify.

    for  gcc/testsuite/ChangeLog

            PR middle-end/112938
            * gcc.dg/strub-internal-volatile.c: New.

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

* [Bug middle-end/112938] ice with -fstrub=internal
  2023-12-09 11:45 [Bug c++/112938] New: ice with -fstrub=internal dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2023-12-14 13:41 ` cvs-commit at gcc dot gnu.org
@ 2023-12-14 13:41 ` cvs-commit at gcc dot gnu.org
  2023-12-20  0:22 ` aoliva at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-14 13:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aoliva@gcc.gnu.org>:

https://gcc.gnu.org/g:e1e71b4e0681974b3db41afa7fc18720a30d6848

commit r14-6547-ge1e71b4e0681974b3db41afa7fc18720a30d6848
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Thu Dec 14 10:41:19 2023 -0300

    strub: indirect volatile parms in wrappers

    Arrange for strub internal wrappers to pass volatile arguments by
    reference to the wrapped bodies.


    for  gcc/ChangeLog

            PR middle-end/112938
            * ipa-strub.cc (pass_ipa_strub::execute): Pass volatile args
            by reference to internal strub wrapped bodies.

    for  gcc/testsuite/ChangeLog

            PR middle-end/112938
            * gcc.dg/strub-internal-volatile.c: Check indirection of
            volatile args.

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

* [Bug middle-end/112938] ice with -fstrub=internal
  2023-12-09 11:45 [Bug c++/112938] New: ice with -fstrub=internal dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2023-12-14 13:41 ` cvs-commit at gcc dot gnu.org
@ 2023-12-20  0:22 ` aoliva at gcc dot gnu.org
  2024-02-27 11:23 ` dcb314 at hotmail dot com
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2023-12-20  0:22 UTC (permalink / raw)
  To: gcc-bugs

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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Fixed.

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

* [Bug middle-end/112938] ice with -fstrub=internal
  2023-12-09 11:45 [Bug c++/112938] New: ice with -fstrub=internal dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2023-12-20  0:22 ` aoliva at gcc dot gnu.org
@ 2024-02-27 11:23 ` dcb314 at hotmail dot com
  2024-02-28  8:20 ` dcb314 at hotmail dot com
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dcb314 at hotmail dot com @ 2024-02-27 11:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Alexandre Oliva from comment #7)
> Fixed.

Seems to have reappeared:

$ ~/gcc/results/bin/gcc -c -fstrub=internal bug988.cc
bt2_locks.cpp: In function ‘void mcs_lock::spin_while_eq(const volatile
std::atomic_bool&, bool)’:
bt2_locks.cpp:36:1: error: invalid address operand in ‘mem_ref’
*expected;

# VUSE <.MEM_8>
expected.8_3 ={v} *expected;
during IPA pass: strub
bt2_locks.cpp:36:1: internal compiler error: verify_gimple failed
0x11f4a92 verify_gimple_in_cfg(function*, bool, bool)
        /home/dcb38/gcc/working/gcc/../../trunk.20210101/gcc/tree-cfg.cc:5663
0x1065788 execute_function_todo(function*, void*)
        /home/dcb38/gcc/working/gcc/../../trunk.20210101/gcc/passes.cc:2088

I would be grateful if someone could confirm what I am seeing here.

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

* [Bug middle-end/112938] ice with -fstrub=internal
  2023-12-09 11:45 [Bug c++/112938] New: ice with -fstrub=internal dcb314 at hotmail dot com
                   ` (7 preceding siblings ...)
  2024-02-27 11:23 ` dcb314 at hotmail dot com
@ 2024-02-28  8:20 ` dcb314 at hotmail dot com
  2024-03-08 11:05 ` aoliva at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dcb314 at hotmail dot com @ 2024-02-28  8:20 UTC (permalink / raw)
  To: gcc-bugs

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

David Binderman <dcb314 at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #9 from David Binderman <dcb314 at hotmail dot com> ---
The reduced source code of comment 1 seems to compile ok, but the original 
attached source code doesn't.

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

* [Bug middle-end/112938] ice with -fstrub=internal
  2023-12-09 11:45 [Bug c++/112938] New: ice with -fstrub=internal dcb314 at hotmail dot com
                   ` (8 preceding siblings ...)
  2024-02-28  8:20 ` dcb314 at hotmail dot com
@ 2024-03-08 11:05 ` aoliva at gcc dot gnu.org
  2024-04-16  5:02 ` cvs-commit at gcc dot gnu.org
  2024-04-18  9:51 ` aoliva at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2024-03-08 11:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Thanks, yeah, I can duplicate the problem using the original testcase.

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

* [Bug middle-end/112938] ice with -fstrub=internal
  2023-12-09 11:45 [Bug c++/112938] New: ice with -fstrub=internal dcb314 at hotmail dot com
                   ` (9 preceding siblings ...)
  2024-03-08 11:05 ` aoliva at gcc dot gnu.org
@ 2024-04-16  5:02 ` cvs-commit at gcc dot gnu.org
  2024-04-18  9:51 ` aoliva at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-16  5:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aoliva@gcc.gnu.org>:

https://gcc.gnu.org/g:c39dc5bb65c492fafc5a0fde83708b8d24e0338d

commit r14-9985-gc39dc5bb65c492fafc5a0fde83708b8d24e0338d
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Tue Apr 16 01:24:59 2024 -0300

    [strub] improve handling of indirected volatile parms [PR112938]

    The earlier patch for PR112938 arranged for volatile parms to be made
    indirect in internal strub wrapped bodies.

    The first problem that remained, more evident, was that the indirected
    parameter remained volatile, despite the indirection, but it wasn't
    regimplified, so indirecting it was malformed gimple.

    Regimplifying turned out not to be needed.  The best course of action
    was to drop the volatility from the by-reference parm, that was being
    unexpectedly inherited from the original volatile parm.

    That exposed another problem: the dereferences would then lose their
    volatile status, so we had to bring volatile back to them.


    for  gcc/ChangeLog

            PR middle-end/112938
            * ipa-strub.cc (pass_ipa_strub::execute): Drop volatility from
            indirected parm.
            (maybe_make_indirect): Restore volatility in dereferences.

    for  gcc/testsuite/ChangeLog

            PR middle-end/112938
            * g++.dg/strub-internal-pr112938.cc: New.

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

* [Bug middle-end/112938] ice with -fstrub=internal
  2023-12-09 11:45 [Bug c++/112938] New: ice with -fstrub=internal dcb314 at hotmail dot com
                   ` (10 preceding siblings ...)
  2024-04-16  5:02 ` cvs-commit at gcc dot gnu.org
@ 2024-04-18  9:51 ` aoliva at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2024-04-18  9:51 UTC (permalink / raw)
  To: gcc-bugs

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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|REOPENED                    |RESOLVED

--- Comment #12 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Fixed

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

end of thread, other threads:[~2024-04-18  9:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-09 11:45 [Bug c++/112938] New: ice with -fstrub=internal dcb314 at hotmail dot com
2023-12-09 11:48 ` [Bug c++/112938] " dcb314 at hotmail dot com
2023-12-09 20:17 ` [Bug middle-end/112938] " pinskia at gcc dot gnu.org
2023-12-11 16:25 ` aoliva at gcc dot gnu.org
2023-12-12  2:13 ` aoliva at gcc dot gnu.org
2023-12-14 13:41 ` cvs-commit at gcc dot gnu.org
2023-12-14 13:41 ` cvs-commit at gcc dot gnu.org
2023-12-20  0:22 ` aoliva at gcc dot gnu.org
2024-02-27 11:23 ` dcb314 at hotmail dot com
2024-02-28  8:20 ` dcb314 at hotmail dot com
2024-03-08 11:05 ` aoliva at gcc dot gnu.org
2024-04-16  5:02 ` cvs-commit at gcc dot gnu.org
2024-04-18  9:51 ` aoliva 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).