public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "r.j.dejong at student dot utwente.nl" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/105663] New: Segmentation Fault on optimization level O2/O3
Date: Thu, 19 May 2022 15:47:32 +0000	[thread overview]
Message-ID: <bug-105663-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 105663
           Summary: Segmentation Fault on optimization level O2/O3
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: r.j.dejong at student dot utwente.nl
  Target Milestone: ---

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

Source file of STM32U5 HAL library fails to compile on arm-none-eabi-gcc 12.1.0
with optimization levels O2 or O3. Command used to reproduce: arm-none-eabi-gcc
-O2 -c source.c -o foo .

The error also occurs for x86-64 GCC. Using godbolt.org compiler explorer, I
found that the minimum GCC version is 11.1 for this segfault to occur.

Preprocessed source code is attached (file source.c). The backtrace is:

> arm-none-eabi-gcc -O2 -c source.c -o foo
during GIMPLE pass: evrp
./stm32u5xx_hal_dma_ex.c: In function 'HAL_DMAEx_List_ReplaceNode_Head':
./stm32u5xx_hal_dma_ex.c:4689:1: internal compiler error: Segmentation fault
 4689 | }
      | ^
0x165320d internal_error(char const*, ...)
        ???:0
0x158bc83 operator_bitwise_not::fold_range(irange&, tree_node*, irange const&,
irange const&, tree_code) const
        ???:0
0x149a439 fold_using_range::range_of_range_op(irange&, gimple*, fur_source&)
        ???:0
0x149bfcb fold_using_range::fold_stmt(irange&, gimple*, fur_source&,
tree_node*)
        ???:0
0x1490448 gimple_ranger::range_of_stmt(irange&, gimple*, tree_node*)
        ???:0
0x1490d43 gimple_ranger::range_of_expr(irange&, tree_node*, gimple*)
        ???:0
0xe3f061 range_query::value_of_expr(tree_node*, gimple*)
        ???:0
0xe1f5d6 rvrp_folder::value_of_expr(tree_node*, gimple*)
        ???:0
0xd30f2e substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
        ???:0
0x1462b37 dom_walker::walk(basic_block_def*)
        ???:0
0xd301fd substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
        ???:0
0xe15b7a execute_ranger_vrp(function*, bool)
        ???:0

Version information:
> arm-none-eabi-gcc --version
arm-none-eabi-gcc (Arch Repository) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

> gcc --version
gcc (GCC) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

OS information:
> lsb_release -a
LSB Version:    n/a
Distributor ID: ManjaroLinux
Description:    Manjaro Linux
Release:        21.2.6
Codename:       Qonos

--------------

My attempts to localize the offending source code were not very successful.
Although the error suggests something is wrong with
HAL_DMAEx_List_InsertNode_Head, if that function is removed the segfault jumps
to another function (with varying backtraces). By some trial and error I was
able to minimize the LOC to be removed to the function
DMA_List_CheckNodesBaseAddresses, lines 11827 till 11844. When these are
commented out, the segfault disappears. However, solely that function does not
seem to be responsible for the error, so I am unsure how useful this
information is for chasing a moving target, so therefore I included the
complete file.

             reply	other threads:[~2022-05-19 15:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-19 15:47 r.j.dejong at student dot utwente.nl [this message]
2022-05-19 15:52 ` [Bug tree-optimization/105663] [12/13 Regression] ICE (segfault) in operator_bitwise_not::fold_range with O2/O3 pinskia at gcc dot gnu.org
2022-05-19 16:14 ` pinskia at gcc dot gnu.org
2022-05-19 16:19 ` pinskia at gcc dot gnu.org
2022-05-19 16:35 ` amacleod at redhat dot com
2022-05-19 16:37 ` amacleod at redhat dot com
2022-05-19 20:23 ` marxin at gcc dot gnu.org
2022-05-19 20:26 ` [Bug tree-optimization/105663] [11/12/13 " pinskia at gcc dot gnu.org
2022-05-20  6:37 ` rguenth at gcc dot gnu.org
2022-05-20  6:37 ` rguenth at gcc dot gnu.org
2022-05-20  6:38 ` rguenth at gcc dot gnu.org
2022-05-20 10:44 ` [Bug tree-optimization/105663] [11/12/13 Regression] ICE (segfault) in operator_bitwise_not::fold_range with O1/O2/O3/Os gcc-hbfypl at hansdejong dot eu
2022-10-31 18:55 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-105663-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).