public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/102955] New: assembler errors when bootstrapping with #pragma optimize "0"
@ 2021-10-26 17:36 msebor at gcc dot gnu.org
  2021-10-26 22:28 ` [Bug middle-end/102955] " pinskia at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-10-26 17:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102955
           Summary: assembler errors when bootstrapping with #pragma
                    optimize "0"
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

This is to make a record of a problem I recently ran into with GCC 12 and that
apparently others have as well.  As discussed here:
https://gcc.gnu.org/pipermail/gcc/2021-October/237616.html

Putting #pragma GCC optimize "0" at the top of gimplify.c to debug something in
a bootstrapped compiler causes the file to fail to assemble with a stage 2 GCC
due to many assembler errors like this:

/tmp/ccL9zcXD.s: Assembler messages:
/tmp/ccL9zcXD.s:9: Error: CFI instruction used without previous 
.cfi_startproc

The top of gimplify.s is below (this is with no other code changes to any files
except the #pragma).

        .file   "gimplify.c"
        .text
        .local  _ZZ20gimplify_va_arg_exprPP9tree_nodePP6gimpleS4_E9gave_help
        .comm  
_ZZ20gimplify_va_arg_exprPP9tree_nodePP6gimpleS4_E9gave_help,1,1
        .p2align 4
        .type   _ZL19handled_component_pPK9tree_node, @function
_ZL19handled_component_pPK9tree_node:
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset 6, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register 6
        movq    %rdi, -8(%rbp)
        movq    -8(%rbp), %rax
        movzwl  (%rax), %eax
        movzwl  %ax, %eax
        subl    $47, %eax
        cmpl    $6, %eax
        ja      .L2
        movl    $1, %eax
        jmp     .L3
.L2:
        movl    $0, %eax
.L3:
        popq    %rbp
        .cfi_def_cfa 7, 8
        ret

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

* [Bug middle-end/102955] assembler errors when bootstrapping with #pragma optimize "0"
  2021-10-26 17:36 [Bug bootstrap/102955] New: assembler errors when bootstrapping with #pragma optimize "0" msebor at gcc dot gnu.org
@ 2021-10-26 22:28 ` pinskia at gcc dot gnu.org
  2021-10-26 22:29 ` [Bug debug/102955] " pinskia at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 22:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, maybe -gtoggle is the cause ....
Because stage3 works ...

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

* [Bug debug/102955] assembler errors when bootstrapping with #pragma optimize "0"
  2021-10-26 17:36 [Bug bootstrap/102955] New: assembler errors when bootstrapping with #pragma optimize "0" msebor at gcc dot gnu.org
  2021-10-26 22:28 ` [Bug middle-end/102955] " pinskia at gcc dot gnu.org
@ 2021-10-26 22:29 ` pinskia at gcc dot gnu.org
  2021-10-26 22:32 ` pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 22:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> Hmm, maybe -gtoggle is the cause ....
> Because stage3 works ...

Yes it is -gtoggle issue.

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

* [Bug debug/102955] assembler errors when bootstrapping with #pragma optimize "0"
  2021-10-26 17:36 [Bug bootstrap/102955] New: assembler errors when bootstrapping with #pragma optimize "0" msebor at gcc dot gnu.org
  2021-10-26 22:28 ` [Bug middle-end/102955] " pinskia at gcc dot gnu.org
  2021-10-26 22:29 ` [Bug debug/102955] " pinskia at gcc dot gnu.org
@ 2021-10-26 22:32 ` pinskia at gcc dot gnu.org
  2021-10-26 22:35 ` pinskia at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 22:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 51671
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51671&action=edit
gimplify.ii from aarch64 (bz2)

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

* [Bug debug/102955] assembler errors when bootstrapping with #pragma optimize "0"
  2021-10-26 17:36 [Bug bootstrap/102955] New: assembler errors when bootstrapping with #pragma optimize "0" msebor at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-10-26 22:32 ` pinskia at gcc dot gnu.org
@ 2021-10-26 22:35 ` pinskia at gcc dot gnu.org
  2021-10-26 22:42 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 22:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Without -O2 we get an ICE:
ubuntu@ubuntu:~/src/upstream-gcc-aarch64/gcc/objdir/gcc\# ../stage1-gcc/xgcc
-B../stage1-gcc gimplify.ii -c -g2 -gtoggle
during RTL pass: final
/home/ubuntu/src/upstream-gcc-aarch64/gcc/gcc/gimplify.c: In function
‘gimplify_omp_ctx* new_omp_context(omp_region_type)’:
/home/ubuntu/src/upstream-gcc-aarch64/gcc/gcc/gimplify.c:472:1: internal
compiler error: Segmentation fault
  472 | }
      | ^
0x18fd7e3 crash_signal
        /home/ubuntu/src/upstream-gcc-aarch64/gcc/gcc/toplev.c:322
0x122e09b dw2_asm_output_delta_uleb128(char const*, char const*, char const*,
...)
        /home/ubuntu/src/upstream-gcc-aarch64/gcc/gcc/dwarf2asm.c:863
0x12e2b3b dw2_output_call_site_table
        /home/ubuntu/src/upstream-gcc-aarch64/gcc/gcc/except.c:2857
0x12e3573 output_one_function_exception_table
        /home/ubuntu/src/upstream-gcc-aarch64/gcc/gcc/except.c:3141
0x12e38f3 output_function_exception_table(int)
        /home/ubuntu/src/upstream-gcc-aarch64/gcc/gcc/except.c:3228
0x1352dcb rest_of_handle_final
        /home/ubuntu/src/upstream-gcc-aarch64/gcc/gcc/final.c:4298
0x1353187 execute
        /home/ubuntu/src/upstream-gcc-aarch64/gcc/gcc/final.c:4363
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug debug/102955] assembler errors when bootstrapping with #pragma optimize "0"
  2021-10-26 17:36 [Bug bootstrap/102955] New: assembler errors when bootstrapping with #pragma optimize "0" msebor at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-10-26 22:35 ` pinskia at gcc dot gnu.org
@ 2021-10-26 22:42 ` pinskia at gcc dot gnu.org
  2021-10-26 23:05 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 22:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #4)
> Without -O2 we get an ICE:

With -fno-exceptions removes the ICE but the assembler error is still there.
Reducing ....

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

* [Bug debug/102955] assembler errors when bootstrapping with #pragma optimize "0"
  2021-10-26 17:36 [Bug bootstrap/102955] New: assembler errors when bootstrapping with #pragma optimize "0" msebor at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-10-26 22:42 ` pinskia at gcc dot gnu.org
@ 2021-10-26 23:05 ` pinskia at gcc dot gnu.org
  2021-10-26 23:07 ` [Bug debug/102955] [12 Regression] ICE with #pragma optimize "0" and -g -gtoggle pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 23:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-10-26
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase compile with -g -gtoggle:
#pragma GCC optimize "0"
struct j
{
  explicit j ();
  ~j ();
};
void g (void)
{
  new j();
}
---- CUT ---
The ICE changes to the assembler failure if you add -fno-exceptions even.

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

* [Bug debug/102955] [12 Regression] ICE with #pragma optimize "0" and -g -gtoggle
  2021-10-26 17:36 [Bug bootstrap/102955] New: assembler errors when bootstrapping with #pragma optimize "0" msebor at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-10-26 23:05 ` pinskia at gcc dot gnu.org
@ 2021-10-26 23:07 ` pinskia at gcc dot gnu.org
  2021-10-26 23:12 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 23:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|assembler errors when       |[12 Regression] ICE with
                   |bootstrapping with #pragma  |#pragma optimize "0" and -g
                   |optimize "0"                |-gtoggle
      Known to work|                            |10.1.0, 11.1.0
   Target Milestone|---                         |12.0

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
And it is a regression in trunk.

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

* [Bug debug/102955] [12 Regression] ICE with #pragma optimize "0" and -g -gtoggle
  2021-10-26 17:36 [Bug bootstrap/102955] New: assembler errors when bootstrapping with #pragma optimize "0" msebor at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-10-26 23:07 ` [Bug debug/102955] [12 Regression] ICE with #pragma optimize "0" and -g -gtoggle pinskia at gcc dot gnu.org
@ 2021-10-26 23:12 ` pinskia at gcc dot gnu.org
  2021-10-28 10:02 ` acoplan at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 23:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
A bisection would be good.
I am suspecting r12-4608-b4702276615f or r12-4038-g6de9f0c13b27c .

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

* [Bug debug/102955] [12 Regression] ICE with #pragma optimize "0" and -g -gtoggle
  2021-10-26 17:36 [Bug bootstrap/102955] New: assembler errors when bootstrapping with #pragma optimize "0" msebor at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2021-10-26 23:12 ` pinskia at gcc dot gnu.org
@ 2021-10-28 10:02 ` acoplan at gcc dot gnu.org
  2021-10-28 22:35 ` [Bug debug/102955] [12 Regression] ICE with #pragma optimize "0" or attribute optimize " pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-10-28 10:02 UTC (permalink / raw)
  To: gcc-bugs

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

Alex Coplan <acoplan at gcc dot gnu.org> changed:

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

--- Comment #9 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Started with r12-4608-gb4702276615ff8d43bc910e7a54fdd850ad8d461:

commit b4702276615ff8d43bc910e7a54fdd850ad8d461
Author: Martin Liska <mliska@suse.cz>
Date:   Thu Oct 14 13:57:18 2021

    options: Fix variable tracking option processing.

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

* [Bug debug/102955] [12 Regression] ICE with #pragma optimize "0" or attribute optimize and -g -gtoggle
  2021-10-26 17:36 [Bug bootstrap/102955] New: assembler errors when bootstrapping with #pragma optimize "0" msebor at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2021-10-28 10:02 ` acoplan at gcc dot gnu.org
@ 2021-10-28 22:35 ` pinskia at gcc dot gnu.org
  2021-11-01  3:59 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-28 22:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |blocker

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note this breaks Ada building on some darwin targets because ada/sigtramp-ios.c
use the attribute optimize.

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

* [Bug debug/102955] [12 Regression] ICE with #pragma optimize "0" or attribute optimize and -g -gtoggle
  2021-10-26 17:36 [Bug bootstrap/102955] New: assembler errors when bootstrapping with #pragma optimize "0" msebor at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2021-10-28 22:35 ` [Bug debug/102955] [12 Regression] ICE with #pragma optimize "0" or attribute optimize " pinskia at gcc dot gnu.org
@ 2021-11-01  3:59 ` marxin at gcc dot gnu.org
  2021-11-05 12:01 ` cvs-commit at gcc dot gnu.org
  2021-11-05 12:02 ` marxin at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-01  3:59 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

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

--- Comment #11 from Martin Liška <marxin at gcc dot gnu.org> ---
Mine, thanks for the reduction.

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

* [Bug debug/102955] [12 Regression] ICE with #pragma optimize "0" or attribute optimize and -g -gtoggle
  2021-10-26 17:36 [Bug bootstrap/102955] New: assembler errors when bootstrapping with #pragma optimize "0" msebor at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2021-11-01  3:59 ` marxin at gcc dot gnu.org
@ 2021-11-05 12:01 ` cvs-commit at gcc dot gnu.org
  2021-11-05 12:02 ` marxin at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-05 12:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:

https://gcc.gnu.org/g:14c7041a1f00ef4ee9a036e0b369c97646db5b5c

commit r12-4934-g14c7041a1f00ef4ee9a036e0b369c97646db5b5c
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Nov 1 16:28:34 2021 +0100

    Reset when -gtoggle is used in gcc_options.

            PR debug/102955

    gcc/ChangeLog:

            * opts.c (finish_options): Reset flag_gtoggle when it is used.

    gcc/testsuite/ChangeLog:

            * g++.dg/pr102955.C: New test.

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

* [Bug debug/102955] [12 Regression] ICE with #pragma optimize "0" or attribute optimize and -g -gtoggle
  2021-10-26 17:36 [Bug bootstrap/102955] New: assembler errors when bootstrapping with #pragma optimize "0" msebor at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2021-11-05 12:01 ` cvs-commit at gcc dot gnu.org
@ 2021-11-05 12:02 ` marxin at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-05 12:02 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

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

--- Comment #13 from Martin Liška <marxin at gcc dot gnu.org> ---
Should be fixed now.

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

end of thread, other threads:[~2021-11-05 12:02 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 17:36 [Bug bootstrap/102955] New: assembler errors when bootstrapping with #pragma optimize "0" msebor at gcc dot gnu.org
2021-10-26 22:28 ` [Bug middle-end/102955] " pinskia at gcc dot gnu.org
2021-10-26 22:29 ` [Bug debug/102955] " pinskia at gcc dot gnu.org
2021-10-26 22:32 ` pinskia at gcc dot gnu.org
2021-10-26 22:35 ` pinskia at gcc dot gnu.org
2021-10-26 22:42 ` pinskia at gcc dot gnu.org
2021-10-26 23:05 ` pinskia at gcc dot gnu.org
2021-10-26 23:07 ` [Bug debug/102955] [12 Regression] ICE with #pragma optimize "0" and -g -gtoggle pinskia at gcc dot gnu.org
2021-10-26 23:12 ` pinskia at gcc dot gnu.org
2021-10-28 10:02 ` acoplan at gcc dot gnu.org
2021-10-28 22:35 ` [Bug debug/102955] [12 Regression] ICE with #pragma optimize "0" or attribute optimize " pinskia at gcc dot gnu.org
2021-11-01  3:59 ` marxin at gcc dot gnu.org
2021-11-05 12:01 ` cvs-commit at gcc dot gnu.org
2021-11-05 12:02 ` marxin 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).