public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/64744] New: ARM: gcc internal compiler error: in store_field, at expr.c:6659
@ 2015-01-23 10:56 coopht at gmail dot com
  2015-01-23 13:47 ` [Bug middle-end/64744] " jgreenhalgh at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: coopht at gmail dot com @ 2015-01-23 10:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64744
           Summary: ARM: gcc internal compiler error: in store_field, at
                    expr.c:6659
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: coopht at gmail dot com

Created attachment 34544
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34544&action=edit
Test to reproduce ICE on gcc's trunk

ICE occured while compiling attach like this:
./cc1 -O0 test_segfault_array.c

Reproduced on:

svn+ssh://gcc.gnu.org/svn/gcc/trunk@220028


Backtrace:
test_segfault_array.c: In function 'foo':
test_segfault_array.c:4:10: internal compiler error: in store_field, at
expr.c:6659
     char a [2] = {0};
          ^
0x92a415 store_field
        /mnt/staff/compiler/gcc-head/src/gcc/gcc/expr.c:6659
0x9236e5 expand_assignment(tree_node*, tree_node*, bool)
        /mnt/staff/compiler/gcc-head/src/gcc/gcc/expr.c:5000
0x7f0544 expand_gimple_stmt_1
        /mnt/staff/compiler/gcc-head/src/gcc/gcc/cfgexpand.c:3398
0x7f0958 expand_gimple_stmt
        /mnt/staff/compiler/gcc-head/src/gcc/gcc/cfgexpand.c:3494
0x7f7afa expand_gimple_basic_block
        /mnt/staff/compiler/gcc-head/src/gcc/gcc/cfgexpand.c:5407
0x7f9519 execute
        /mnt/staff/compiler/gcc-head/src/gcc/gcc/cfgexpand.c:6016
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


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

* [Bug middle-end/64744] ARM: gcc internal compiler error: in store_field, at expr.c:6659
  2015-01-23 10:56 [Bug middle-end/64744] New: ARM: gcc internal compiler error: in store_field, at expr.c:6659 coopht at gmail dot com
@ 2015-01-23 13:47 ` jgreenhalgh at gcc dot gnu.org
  2015-01-23 13:53 ` coopht at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jgreenhalgh at gcc dot gnu.org @ 2015-01-23 13:47 UTC (permalink / raw)
  To: gcc-bugs

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

jgreenhalgh at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|aarch64                     |arm-none-linux-gnueabihf
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-01-23
                 CC|                            |jgreenhalgh at gcc dot gnu.org
               Host|x86_64                      |x86_64-unknown-linux-gnu
     Ever confirmed|0                           |1

--- Comment #1 from jgreenhalgh at gcc dot gnu.org ---
I can't reproduce this for an AArch64 target.

As far as I can remember, we don't support __attribute__((naked)) for AArch64,
so I would expect the attribute to be ignored (And that is what I see with your
testcase):

gcc foo.c  -O0
foo.c:3:1: warning: ‘naked’ attribute directive ignored [-Wattributes]
 {
 ^

However, I can reproduce your bug with an ARM compiler (cross and native), so
I'll confirm the bug, and update the Target field for you.
>From gcc-bugs-return-474566-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jan 23 13:51:24 2015
Return-Path: <gcc-bugs-return-474566-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 739 invoked by alias); 23 Jan 2015 13:51:21 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 607 invoked by uid 48); 23 Jan 2015 13:51:08 -0000
From: "dwmw2 at infradead dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/55177] missed optimizations with __builtin_bswap
Date: Fri, 23 Jan 2015 13:51:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.7.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: dwmw2 at infradead dot org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-55177-4-HEdC03GpIJ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-55177-4@http.gcc.gnu.org/bugzilla/>
References: <bug-55177-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg02560.txt.bz2
Content-length: 771

https://gcc.gnu.org/bugzilla/show_bug.cgi?idU177

--- Comment #15 from David Woodhouse <dwmw2 at infradead dot org> ---
More missed optimistions (gcc version 4.9.2 20141101 (Red Hat 4.9.2-1) (GCC))

I see it using movbe for the pointer_abuse() function, but can't see a simple
way to make it use movbe *without* killing kittens.

gcc -march=atom -O2 -x c -o - -S - -Wstrict-aliasing <<EOF

struct pkt {
    unsigned char data[10];
};

unsigned or(struct pkt *p)
{
    return (p->data[0] << 24) | (p->data[1] << 16) | (p->data[2] << 8) |
p->data[1];
}

unsigned add(struct pkt *p)
{
    return (p->data[0] << 24) + (p->data[1] << 16) + (p->data[2] << 8) +
p->data[1];
}

unsigned pointer_abuse(struct pkt *p)
{
    return __builtin_bswap32(*(unsigned *)p->data);
}
EOF


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

* [Bug middle-end/64744] ARM: gcc internal compiler error: in store_field, at expr.c:6659
  2015-01-23 10:56 [Bug middle-end/64744] New: ARM: gcc internal compiler error: in store_field, at expr.c:6659 coopht at gmail dot com
  2015-01-23 13:47 ` [Bug middle-end/64744] " jgreenhalgh at gcc dot gnu.org
@ 2015-01-23 13:53 ` coopht at gmail dot com
  2015-01-23 13:56 ` ktkachov at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: coopht at gmail dot com @ 2015-01-23 13:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Alexander Basov <coopht at gmail dot com> ---
Yep, sorry it's for ARM target.


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

* [Bug middle-end/64744] ARM: gcc internal compiler error: in store_field, at expr.c:6659
  2015-01-23 10:56 [Bug middle-end/64744] New: ARM: gcc internal compiler error: in store_field, at expr.c:6659 coopht at gmail dot com
  2015-01-23 13:47 ` [Bug middle-end/64744] " jgreenhalgh at gcc dot gnu.org
  2015-01-23 13:53 ` coopht at gmail dot com
@ 2015-01-23 13:56 ` ktkachov at gcc dot gnu.org
  2015-01-23 13:58 ` coopht at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2015-01-23 13:56 UTC (permalink / raw)
  To: gcc-bugs

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

ktkachov at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ktkachov at gcc dot gnu.org
      Known to fail|                            |4.8.5, 4.9.3, 5.0

--- Comment #3 from ktkachov at gcc dot gnu.org ---
Confirmed as well on all release branches.


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

* [Bug middle-end/64744] ARM: gcc internal compiler error: in store_field, at expr.c:6659
  2015-01-23 10:56 [Bug middle-end/64744] New: ARM: gcc internal compiler error: in store_field, at expr.c:6659 coopht at gmail dot com
                   ` (2 preceding siblings ...)
  2015-01-23 13:56 ` ktkachov at gcc dot gnu.org
@ 2015-01-23 13:58 ` coopht at gmail dot com
  2015-01-23 14:08 ` ktkachov at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: coopht at gmail dot com @ 2015-01-23 13:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Alexander Basov <coopht at gmail dot com> ---
(In reply to ktkachov from comment #3)
> Confirmed as well on all release branches.

Ok, If you have no any objections, I'd like to fix it.

BTW, what gcc should do with such code?


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

* [Bug middle-end/64744] ARM: gcc internal compiler error: in store_field, at expr.c:6659
  2015-01-23 10:56 [Bug middle-end/64744] New: ARM: gcc internal compiler error: in store_field, at expr.c:6659 coopht at gmail dot com
                   ` (3 preceding siblings ...)
  2015-01-23 13:58 ` coopht at gmail dot com
@ 2015-01-23 14:08 ` ktkachov at gcc dot gnu.org
  2015-06-02  6:43 ` coopht at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2015-01-23 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from ktkachov at gcc dot gnu.org ---
(In reply to Alexander Basov from comment #4)
> (In reply to ktkachov from comment #3)
> > Confirmed as well on all release branches.
> 
> Ok, If you have no any objections, I'd like to fix it.
> 
> BTW, what gcc should do with such code?

Patches welcome :)
Though I note the ICE only happens at -O0 and disappears if you enable any
optimisation.
According to: https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
the 'naked' attribute will omit the prologue/epilogue of the function but it's
supposed to be used only with inline asm and C code is not expected to work
reliably. That being said, we should never ICE...


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

* [Bug middle-end/64744] ARM: gcc internal compiler error: in store_field, at expr.c:6659
  2015-01-23 10:56 [Bug middle-end/64744] New: ARM: gcc internal compiler error: in store_field, at expr.c:6659 coopht at gmail dot com
                   ` (4 preceding siblings ...)
  2015-01-23 14:08 ` ktkachov at gcc dot gnu.org
@ 2015-06-02  6:43 ` coopht at gmail dot com
  2015-08-03 19:35 ` law at gcc dot gnu.org
  2015-08-03 19:36 ` law at redhat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: coopht at gmail dot com @ 2015-06-02  6:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Alexander Basov <coopht at gmail dot com> ---

Hi, could you please take a look at this fix:
https://gcc.gnu.org/ml/gcc-patches/2015-06/msg00027.html

It also fixes:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48470
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43404


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

* [Bug middle-end/64744] ARM: gcc internal compiler error: in store_field, at expr.c:6659
  2015-01-23 10:56 [Bug middle-end/64744] New: ARM: gcc internal compiler error: in store_field, at expr.c:6659 coopht at gmail dot com
                   ` (5 preceding siblings ...)
  2015-06-02  6:43 ` coopht at gmail dot com
@ 2015-08-03 19:35 ` law at gcc dot gnu.org
  2015-08-03 19:36 ` law at redhat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: law at gcc dot gnu.org @ 2015-08-03 19:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Author: law
Date: Mon Aug  3 19:34:31 2015
New Revision: 226528

URL: https://gcc.gnu.org/viewcvs?rev=226528&root=gcc&view=rev
Log:
        PR middle-end/64744
        PR middle-end/48470
        PR middle-end/43404
        * cfgexpand.c (expand_one_var): Add check if stack is going to
        be used in naked function.
        * expr.c (expand_expr_addr_expr_1): Remove excess checking
        whether expression should not reside in MEM.
        * function.c (use_register_for_decl): Do not use registers for
        non-register things (volatile, float, BLKMode) in naked functions.

        PR middle-end/64744
        PR middle-end/48470
        PR middle-end/43404
        * gcc.target/arm/pr43404.c : New testcase.
        * gcc.target/arm/pr48470.c : New testcase.
        * gcc.target/arm/pr64744-1.c : New testcase.
        * gcc.target/arm/pr64744-2.c : New testcase.

Added:
    trunk/gcc/testsuite/gcc.target/arm/pr43404.c
    trunk/gcc/testsuite/gcc.target/arm/pr48470.c
    trunk/gcc/testsuite/gcc.target/arm/pr64744-1.c
    trunk/gcc/testsuite/gcc.target/arm/pr64744-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgexpand.c
    trunk/gcc/expr.c
    trunk/gcc/function.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug middle-end/64744] ARM: gcc internal compiler error: in store_field, at expr.c:6659
  2015-01-23 10:56 [Bug middle-end/64744] New: ARM: gcc internal compiler error: in store_field, at expr.c:6659 coopht at gmail dot com
                   ` (6 preceding siblings ...)
  2015-08-03 19:35 ` law at gcc dot gnu.org
@ 2015-08-03 19:36 ` law at redhat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: law at redhat dot com @ 2015-08-03 19:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Jeffrey A. Law <law at redhat dot com> ---
Fixed on the trunk.


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

end of thread, other threads:[~2015-08-03 19:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-23 10:56 [Bug middle-end/64744] New: ARM: gcc internal compiler error: in store_field, at expr.c:6659 coopht at gmail dot com
2015-01-23 13:47 ` [Bug middle-end/64744] " jgreenhalgh at gcc dot gnu.org
2015-01-23 13:53 ` coopht at gmail dot com
2015-01-23 13:56 ` ktkachov at gcc dot gnu.org
2015-01-23 13:58 ` coopht at gmail dot com
2015-01-23 14:08 ` ktkachov at gcc dot gnu.org
2015-06-02  6:43 ` coopht at gmail dot com
2015-08-03 19:35 ` law at gcc dot gnu.org
2015-08-03 19:36 ` law at redhat dot com

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).