public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/59134] New: Infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT
@ 2013-11-14 14:41 jules at gcc dot gnu.org
  2013-11-16 15:29 ` [Bug middle-end/59134] " mikpelinux at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: jules at gcc dot gnu.org @ 2013-11-14 14:41 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59134

            Bug ID: 59134
           Summary: Infinite loop between store_fixed_bit_field and
                    store_split_bit_field with STRICT_ALIGNMENT
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jules at gcc dot gnu.org

Compiling code using packed structures with a single non-zero-sized element and
a zero-sized array can lead to segfaults due to stack exhaustion on
STRICT_ALIGNMENT targets (at least PowerPC E500 targets are affected).

See the following for further details:

http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01458.html

Earlier bugs that are possibly related include:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55438

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57748


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

* [Bug middle-end/59134] Infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT
  2013-11-14 14:41 [Bug middle-end/59134] New: Infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT jules at gcc dot gnu.org
@ 2013-11-16 15:29 ` mikpelinux at gmail dot com
  2013-11-24 16:18 ` mikpelinux at gmail dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mikpelinux at gmail dot com @ 2013-11-16 15:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59134

Mikael Pettersson <mikpelinux at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpelinux at gmail dot com

--- Comment #1 from Mikael Pettersson <mikpelinux at gmail dot com> ---
The cited testcase ICEs gcc 4.6/4.7/4.8/4.9 for me on sparc64-linux, another
STRICT_ALIGNMENT target.  gcc 4.5 and older don't ICE.


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

* [Bug middle-end/59134] Infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT
  2013-11-14 14:41 [Bug middle-end/59134] New: Infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT jules at gcc dot gnu.org
  2013-11-16 15:29 ` [Bug middle-end/59134] " mikpelinux at gmail dot com
@ 2013-11-24 16:18 ` mikpelinux at gmail dot com
  2013-12-03 10:41 ` [Bug middle-end/59134] [4.7/4.8/4.9 regression] infinite " ebotcazou at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mikpelinux at gmail dot com @ 2013-11-24 16:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59134

--- Comment #2 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Started with r163189.


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

* [Bug middle-end/59134] [4.7/4.8/4.9 regression] infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT
  2013-11-14 14:41 [Bug middle-end/59134] New: Infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT jules at gcc dot gnu.org
  2013-11-16 15:29 ` [Bug middle-end/59134] " mikpelinux at gmail dot com
  2013-11-24 16:18 ` mikpelinux at gmail dot com
@ 2013-12-03 10:41 ` ebotcazou at gcc dot gnu.org
  2013-12-03 11:24 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2013-12-03 10:41 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59134

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|powerpc-e500                |
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-12-03
                 CC|                            |ebotcazou at gcc dot gnu.org
            Summary|Infinite loop between       |[4.7/4.8/4.9 regression]
                   |store_fixed_bit_field and   |infinite loop between
                   |store_split_bit_field with  |store_fixed_bit_field and
                   |STRICT_ALIGNMENT            |store_split_bit_field with
                   |                            |STRICT_ALIGNMENT
     Ever confirmed|0                           |1

--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Confirmed as a regression by Michael.


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

* [Bug middle-end/59134] [4.7/4.8/4.9 regression] infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT
  2013-11-14 14:41 [Bug middle-end/59134] New: Infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT jules at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-12-03 10:41 ` [Bug middle-end/59134] [4.7/4.8/4.9 regression] infinite " ebotcazou at gcc dot gnu.org
@ 2013-12-03 11:24 ` rguenth at gcc dot gnu.org
  2013-12-03 11:29 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-12-03 11:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59134

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.7.4


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

* [Bug middle-end/59134] [4.7/4.8/4.9 regression] infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT
  2013-11-14 14:41 [Bug middle-end/59134] New: Infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT jules at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-12-03 11:24 ` rguenth at gcc dot gnu.org
@ 2013-12-03 11:29 ` rguenth at gcc dot gnu.org
  2013-12-11 17:09 ` edlinger at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-12-03 11:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59134

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
typedef struct {
  char pad;
  int arr[0];
} __attribute__((packed)) str;

str *
foo (int* src)
{
  str *s = __builtin_malloc (sizeof (str) + sizeof (int));
  s->arr[0] = 0x12345678;
  return s;
}


as said elsewhere - IMHO the mode on op0 should not be that of the
base object (QImode) but that of the access (SImode).


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

* [Bug middle-end/59134] [4.7/4.8/4.9 regression] infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT
  2013-11-14 14:41 [Bug middle-end/59134] New: Infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT jules at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-12-03 11:29 ` rguenth at gcc dot gnu.org
@ 2013-12-11 17:09 ` edlinger at gcc dot gnu.org
  2013-12-19 15:33 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: edlinger at gcc dot gnu.org @ 2013-12-11 17:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59134

--- Comment #5 from edlinger at gcc dot gnu.org ---
Author: edlinger
Date: Wed Dec 11 17:09:17 2013
New Revision: 205898

URL: http://gcc.gnu.org/viewcvs?rev=205898&root=gcc&view=rev
Log:
2013-12-11  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR middle-end/59134
        * expmed.c (store_bit_field): Use narrow_bit_field_mem and
        store_fixed_bit_field_1 for -fstrict-volatile-bitfields.
        (store_fixed_bit_field): Split up.  Call store_fixed_bit_field_1
        to do the real work.
        (store_fixed_bit_field_1): New function.
        (store_split_bit_field): Limit the unit size to the memory mode size,
        to prevent recursion.

testsuite:
        * gcc.c-torture/compile/pr59134.c: New test.
        * gnat.dg/misaligned_volatile.adb: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr59134.c
    trunk/gcc/testsuite/gnat.dg/misaligned_volatile.adb
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/expmed.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug middle-end/59134] [4.7/4.8/4.9 regression] infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT
  2013-11-14 14:41 [Bug middle-end/59134] New: Infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT jules at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2013-12-11 17:09 ` edlinger at gcc dot gnu.org
@ 2013-12-19 15:33 ` rguenth at gcc dot gnu.org
  2014-01-17 19:49 ` law at redhat dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-12-19 15:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59134

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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

* [Bug middle-end/59134] [4.7/4.8/4.9 regression] infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT
  2013-11-14 14:41 [Bug middle-end/59134] New: Infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT jules at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2013-12-19 15:33 ` rguenth at gcc dot gnu.org
@ 2014-01-17 19:49 ` law at redhat dot com
  2014-02-27  7:28 ` jye2 at gcc dot gnu.org
  2015-01-27 17:10 ` edlinger at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: law at redhat dot com @ 2014-01-17 19:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59134

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |law at redhat dot com
         Resolution|---                         |FIXED

--- Comment #6 from Jeffrey A. Law <law at redhat dot com> ---
Should be fixed by Bernd's fix on the trunk.


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

* [Bug middle-end/59134] [4.7/4.8/4.9 regression] infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT
  2013-11-14 14:41 [Bug middle-end/59134] New: Infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT jules at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2014-01-17 19:49 ` law at redhat dot com
@ 2014-02-27  7:28 ` jye2 at gcc dot gnu.org
  2015-01-27 17:10 ` edlinger at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jye2 at gcc dot gnu.org @ 2014-02-27  7:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59134

--- Comment #7 from jye2 at gcc dot gnu.org ---
Author: jye2
Date: Thu Feb 27 07:28:06 2014
New Revision: 208195

URL: http://gcc.gnu.org/viewcvs?rev=208195&root=gcc&view=rev
Log:
2014-02-27  Joey Ye  <joey.ye@arm.com>

        Backport mainline strict-volatile-bitfields fixes
    2013-09-28  Sandra Loosemore  <sandra@codesourcery.com>

        gcc/
        * expr.h (extract_bit_field): Remove packedp parameter.
        * expmed.c (extract_fixed_bit_field): Remove packedp parameter
        from forward declaration.
        (store_split_bit_field): Remove packedp arg from calls to
        extract_fixed_bit_field.
        (extract_bit_field_1): Remove packedp parameter and packedp
        argument from recursive calls and calls to extract_fixed_bit_field.
        (extract_bit_field): Remove packedp parameter and corresponding
        arg to extract_bit_field_1.
        (extract_fixed_bit_field): Remove packedp parameter.  Remove code
        to issue warnings.
        (extract_split_bit_field): Remove packedp arg from call to
        extract_fixed_bit_field.
        * expr.c (emit_group_load_1): Adjust calls to extract_bit_field.
        (copy_blkmode_from_reg): Likewise.
        (copy_blkmode_to_reg): Likewise.
        (read_complex_part): Likewise.
        (store_field): Likewise.
        (expand_expr_real_1): Likewise.
        * calls.c (store_unaligned_arguments_into_pseudos): Adjust call
        to extract_bit_field.
        * config/tilegx/tilegx.c (tilegx_expand_unaligned_load): Adjust
        call to extract_bit_field.
        * config/tilepro/tilepro.c (tilepro_expand_unaligned_load): Adjust
        call to extract_bit_field.
        * doc/invoke.texi (Code Gen Options): Remove mention of warnings
        and special packedp behavior from -fstrict-volatile-bitfields
        documentation.

2013-12-11  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * expr.c (expand_assignment): Remove dependency on 
        flag_strict_volatile_bitfields. Always set the memory
        access mode.
        (expand_expr_real_1): Likewise.

2013-12-11  Sandra Loosemore  <sandra@codesourcery.com>

        PR middle-end/23623
        PR middle-end/48784
        PR middle-end/56341
        PR middle-end/56997

        gcc/
        * expmed.c (strict_volatile_bitfield_p): New function.
        (store_bit_field_1): Don't special-case strict volatile
        bitfields here.
        (store_bit_field): Handle strict volatile bitfields here instead.
        (store_fixed_bit_field): Don't special-case strict volatile
        bitfields here.
        (extract_bit_field_1): Don't special-case strict volatile
        bitfields here.
        (extract_bit_field): Handle strict volatile bitfields here instead.
        (extract_fixed_bit_field): Don't special-case strict volatile
        bitfields here.  Simplify surrounding code to resemble that in
        store_fixed_bit_field.
        * doc/invoke.texi (Code Gen Options): Update
        -fstrict-volatile-bitfields description.

        gcc/testsuite/
        * gcc.dg/pr23623.c: New test.
        * gcc.dg/pr48784-1.c: New test.
        * gcc.dg/pr48784-2.c: New test.
        * gcc.dg/pr56341-1.c: New test.
        * gcc.dg/pr56341-2.c: New test.
        * gcc.dg/pr56997-1.c: New test.
        * gcc.dg/pr56997-2.c: New test.
        * gcc.dg/pr56997-3.c: New test.

2013-12-11  Bernd Edlinger  <bernd.edlinger@hotmail.de>
             Sandra Loosemore  <sandra@codesourcery.com>

        PR middle-end/23623
        PR middle-end/48784
        PR middle-end/56341
        PR middle-end/56997
        * expmed.c (strict_volatile_bitfield_p): Add bitregion_start
        and bitregion_end parameters.  Test for compliance with C++
        memory model.
        (store_bit_field): Adjust call to strict_volatile_bitfield_p.
        Add fallback logic for cases where -fstrict-volatile-bitfields
        is supposed to apply, but cannot.
        (extract_bit_field): Likewise. Use narrow_bit_field_mem and
        extract_fixed_bit_field_1 to do the extraction.
        (extract_fixed_bit_field): Revert to previous mode selection
algorithm.
        Call extract_fixed_bit_field_1 to do the real work.
        (extract_fixed_bit_field_1): New function.

testsuite:
        * gcc.dg/pr23623.c: Update to test interaction with C++
        memory model.

2013-12-11  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR middle-end/59134
        * expmed.c (store_bit_field): Use narrow_bit_field_mem and
        store_fixed_bit_field_1 for -fstrict-volatile-bitfields.
        (store_fixed_bit_field): Split up.  Call store_fixed_bit_field_1
        to do the real work.
        (store_fixed_bit_field_1): New function. 
        (store_split_bit_field): Limit the unit size to the memory mode
size,
        to prevent recursion.

testsuite:
        * gcc.c-torture/compile/pr59134.c: New test.
        * gnat.dg/misaligned_volatile.adb: New test.

Added:
   
branches/ARM/embedded-4_8-branch/gcc/testsuite/gcc.c-torture/compile/pr59134.c
    branches/ARM/embedded-4_8-branch/gcc/testsuite/gcc.dg/pr23623.c
    branches/ARM/embedded-4_8-branch/gcc/testsuite/gcc.dg/pr48784-1.c
    branches/ARM/embedded-4_8-branch/gcc/testsuite/gcc.dg/pr48784-2.c
    branches/ARM/embedded-4_8-branch/gcc/testsuite/gcc.dg/pr56341-1.c
    branches/ARM/embedded-4_8-branch/gcc/testsuite/gcc.dg/pr56341-2.c
    branches/ARM/embedded-4_8-branch/gcc/testsuite/gcc.dg/pr56997-1.c
    branches/ARM/embedded-4_8-branch/gcc/testsuite/gcc.dg/pr56997-2.c
    branches/ARM/embedded-4_8-branch/gcc/testsuite/gcc.dg/pr56997-3.c
   
branches/ARM/embedded-4_8-branch/gcc/testsuite/gnat.dg/misaligned_volatile.adb
Modified:
    branches/ARM/embedded-4_8-branch/gcc/ChangeLog.arm
    branches/ARM/embedded-4_8-branch/gcc/calls.c
    branches/ARM/embedded-4_8-branch/gcc/config/tilegx/tilegx.c
    branches/ARM/embedded-4_8-branch/gcc/config/tilepro/tilepro.c
    branches/ARM/embedded-4_8-branch/gcc/doc/invoke.texi
    branches/ARM/embedded-4_8-branch/gcc/expmed.c
    branches/ARM/embedded-4_8-branch/gcc/expr.c
    branches/ARM/embedded-4_8-branch/gcc/expr.h
    branches/ARM/embedded-4_8-branch/gcc/testsuite/ChangeLog.arm


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

* [Bug middle-end/59134] [4.7/4.8/4.9 regression] infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT
  2013-11-14 14:41 [Bug middle-end/59134] New: Infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT jules at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2014-02-27  7:28 ` jye2 at gcc dot gnu.org
@ 2015-01-27 17:10 ` edlinger at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: edlinger at gcc dot gnu.org @ 2015-01-27 17:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59134
Bug 59134 depends on bug 57748, which changed state.

Bug 57748 Summary: [4.8 Regression] ICE when expanding assignment to unaligned zero-sized array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57748

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


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

end of thread, other threads:[~2015-01-27 17:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-14 14:41 [Bug middle-end/59134] New: Infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT jules at gcc dot gnu.org
2013-11-16 15:29 ` [Bug middle-end/59134] " mikpelinux at gmail dot com
2013-11-24 16:18 ` mikpelinux at gmail dot com
2013-12-03 10:41 ` [Bug middle-end/59134] [4.7/4.8/4.9 regression] infinite " ebotcazou at gcc dot gnu.org
2013-12-03 11:24 ` rguenth at gcc dot gnu.org
2013-12-03 11:29 ` rguenth at gcc dot gnu.org
2013-12-11 17:09 ` edlinger at gcc dot gnu.org
2013-12-19 15:33 ` rguenth at gcc dot gnu.org
2014-01-17 19:49 ` law at redhat dot com
2014-02-27  7:28 ` jye2 at gcc dot gnu.org
2015-01-27 17:10 ` edlinger 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).