public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/99641] New: [11 Regression] opt30.adb, opt49.adb and loop_optimization3.adb fail to build at m32
@ 2021-03-18  9:37 iains at gcc dot gnu.org
  2021-03-18  9:39 ` [Bug ada/99641] " iains at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2021-03-18  9:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99641
           Summary: [11 Regression] opt30.adb, opt49.adb and
                    loop_optimization3.adb fail to build at m32
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iains at gcc dot gnu.org
  Target Milestone: ---

Running target unix/-m32
FAIL: gnat.dg/loop_optimization3.adb (test for excess errors)
FAIL: gnat.dg/opt30.adb (test for excess errors)
FAIL: gnat.dg/opt49.adb (test for excess errors)

this started somewhere between r11-6268 and r11-6339 on Darwin.

On Linux the fail is:
raised STORAGE_ERROR : stack overflow or erroneous memory access

On Darwin:
raised CONSTRAINT_ERROR : erroneous memory access

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

* [Bug ada/99641] [11 Regression] opt30.adb, opt49.adb and loop_optimization3.adb fail to build at m32
  2021-03-18  9:37 [Bug ada/99641] New: [11 Regression] opt30.adb, opt49.adb and loop_optimization3.adb fail to build at m32 iains at gcc dot gnu.org
@ 2021-03-18  9:39 ` iains at gcc dot gnu.org
  2021-03-18  9:58 ` ebotcazou at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2021-03-18  9:39 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-03-18
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
             Target|                            |x86_64-linux-gnu,
                   |                            |x86_64-apple-darwin
                 CC|                            |ebotcazou at gcc dot gnu.org

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

* [Bug ada/99641] [11 Regression] opt30.adb, opt49.adb and loop_optimization3.adb fail to build at m32
  2021-03-18  9:37 [Bug ada/99641] New: [11 Regression] opt30.adb, opt49.adb and loop_optimization3.adb fail to build at m32 iains at gcc dot gnu.org
  2021-03-18  9:39 ` [Bug ada/99641] " iains at gcc dot gnu.org
@ 2021-03-18  9:58 ` ebotcazou at gcc dot gnu.org
  2021-03-18 10:32 ` [Bug middle-end/99641] " ebotcazou at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-03-18  9:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
I can reproduce, it's the expansion of __builtin_memcmp.

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

* [Bug middle-end/99641] [11 Regression] opt30.adb, opt49.adb and loop_optimization3.adb fail to build at m32
  2021-03-18  9:37 [Bug ada/99641] New: [11 Regression] opt30.adb, opt49.adb and loop_optimization3.adb fail to build at m32 iains at gcc dot gnu.org
  2021-03-18  9:39 ` [Bug ada/99641] " iains at gcc dot gnu.org
  2021-03-18  9:58 ` ebotcazou at gcc dot gnu.org
@ 2021-03-18 10:32 ` ebotcazou at gcc dot gnu.org
  2021-03-19  9:42 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-03-18 10:32 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|ada                         |middle-end
   Target Milestone|---                         |11.0
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ebotcazou at gcc dot gnu.org

--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
The offset calculation in native_encode_initializer is incorrect:

              if (index && TREE_CODE (index) == RANGE_EXPR)
                {
                  if (!tree_fits_shwi_p (TREE_OPERAND (index, 0))
                      || !tree_fits_shwi_p (TREE_OPERAND (index, 1)))
                    return 0;
                  pos = (tree_to_shwi (TREE_OPERAND (index, 0)) - min_index)
                        * fieldsize;
                  count = (tree_to_shwi (TREE_OPERAND (index, 1))
                           - tree_to_shwi (TREE_OPERAND (index, 0)));
                }
              else if (index)
                {
                  if (!tree_fits_shwi_p (index))
                    return 0;
                  pos = (tree_to_shwi (index) - min_index) * fieldsize;
                }

It must not be done in HOST_WIDE_INT but in sizetype instead, like in e.g.
get_inner_reference or get_ref_base_and_extent.

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

* [Bug middle-end/99641] [11 Regression] opt30.adb, opt49.adb and loop_optimization3.adb fail to build at m32
  2021-03-18  9:37 [Bug ada/99641] New: [11 Regression] opt30.adb, opt49.adb and loop_optimization3.adb fail to build at m32 iains at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-03-18 10:32 ` [Bug middle-end/99641] " ebotcazou at gcc dot gnu.org
@ 2021-03-19  9:42 ` cvs-commit at gcc dot gnu.org
  2021-03-19  9:46 ` cvs-commit at gcc dot gnu.org
  2021-03-19  9:47 ` ebotcazou at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-19  9:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Eric Botcazou <ebotcazou@gcc.gnu.org>:

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

commit r11-7729-gb980edba506442c846cc779243ceeffd13065740
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Fri Mar 19 09:21:11 2021 +0100

    Fix segfault during encoding of CONSTRUCTORs

    The segfault occurs in native_encode_initializer when it is encoding the
    CONSTRUCTOR for an array whose lower bound is negative (it's OK in Ada).
    The computation of the current position is done in HOST_WIDE_INT and this
    does not work for arrays whose original range has a negative lower bound
    and a positive upper bound; the computation must be done in sizetype
    instead so that it may wrap around.

    gcc/
            PR middle-end/99641
            * fold-const.c (native_encode_initializer) <CONSTRUCTOR>: For an
            array type, do the computation of the current position in sizetype.

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

* [Bug middle-end/99641] [11 Regression] opt30.adb, opt49.adb and loop_optimization3.adb fail to build at m32
  2021-03-18  9:37 [Bug ada/99641] New: [11 Regression] opt30.adb, opt49.adb and loop_optimization3.adb fail to build at m32 iains at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-03-19  9:42 ` cvs-commit at gcc dot gnu.org
@ 2021-03-19  9:46 ` cvs-commit at gcc dot gnu.org
  2021-03-19  9:47 ` ebotcazou at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-19  9:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Eric Botcazou
<ebotcazou@gcc.gnu.org>:

https://gcc.gnu.org/g:376f564b870a0afa64403a9aaf9f0ff1fc7153cf

commit r10-9458-g376f564b870a0afa64403a9aaf9f0ff1fc7153cf
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Fri Mar 19 09:21:11 2021 +0100

    Fix segfault during encoding of CONSTRUCTORs

    The segfault occurs in native_encode_initializer when it is encoding the
    CONSTRUCTOR for an array whose lower bound is negative (it's OK in Ada).
    The computation of the current position is done in HOST_WIDE_INT and this
    does not work for arrays whose original range has a negative lower bound
    and a positive upper bound; the computation must be done in sizetype
    instead so that it may wrap around.

    gcc/
            PR middle-end/99641
            * fold-const.c (native_encode_initializer) <CONSTRUCTOR>: For an
            array type, do the computation of the current position in sizetype.

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

* [Bug middle-end/99641] [11 Regression] opt30.adb, opt49.adb and loop_optimization3.adb fail to build at m32
  2021-03-18  9:37 [Bug ada/99641] New: [11 Regression] opt30.adb, opt49.adb and loop_optimization3.adb fail to build at m32 iains at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-03-19  9:46 ` cvs-commit at gcc dot gnu.org
@ 2021-03-19  9:47 ` ebotcazou at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-03-19  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

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

--- Comment #5 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Thanks for reporting the problem.

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

end of thread, other threads:[~2021-03-19  9:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18  9:37 [Bug ada/99641] New: [11 Regression] opt30.adb, opt49.adb and loop_optimization3.adb fail to build at m32 iains at gcc dot gnu.org
2021-03-18  9:39 ` [Bug ada/99641] " iains at gcc dot gnu.org
2021-03-18  9:58 ` ebotcazou at gcc dot gnu.org
2021-03-18 10:32 ` [Bug middle-end/99641] " ebotcazou at gcc dot gnu.org
2021-03-19  9:42 ` cvs-commit at gcc dot gnu.org
2021-03-19  9:46 ` cvs-commit at gcc dot gnu.org
2021-03-19  9:47 ` ebotcazou 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).