public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/60663] New: Errors out on valid inline asm
@ 2014-03-26  6:06 zhenqiang.chen at linaro dot org
  2014-04-10 16:32 ` [Bug rtl-optimization/60663] [4.9 Regression] " jakub at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: zhenqiang.chen at linaro dot org @ 2014-03-26  6:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60663
           Summary: Errors out on valid inline asm
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhenqiang.chen at linaro dot org

Found while building an arm32 kernel

//fail.c
int g(void)
{
  unsigned i, j;
  asm("// %0 %1" : "=r" (i), "=r"(j));
  return i;
}

arm-linux-gnueabihf-gcc -march=armv7-a -O2 -c fail.c
fail.c: In function ‘g’:
fail.c:4:3: error: invalid 'asm': operand number out of range

Root cause: "cse1" generates illegal asm instruction since check_asm_operands
does not check the number of expected operands.

i.e. "cse1" changes code from
(insn 5 2 6 2 (parallel [
            (set (reg:SI 114 [ i ])
                (asm_operands:SI ("// %0 %1") ("=r") 0 []
                     []
                     [] fail.c:4))
            (set (reg:SI 115 [ j ])
                (asm_operands:SI ("// %0 %1") ("=r") 1 []
                     []
                     [] fail.c:4))
        ]) fail.c:4 -1
     (nil))
(insn 6 5 8 2 (set (reg/v:SI 110 [ i ])
        (reg:SI 114 [ i ])) fail.c:4 664 {*thumb2_movsi_vfp}
     (nil))
to

(insn 12 2 13 2 (set (reg/i:SI 0 r0)
        (asm_operands:SI ("// %0 %1") ("=r") 0 []
             []
             [] fail.c:4)) fail.c:6 -1
     (nil))

No error for x86-64 and arm gcc-4.8. ARM rtx_cost changes in 4.9 trigger this
optimization.

A patch to enhance check_asm_operands is sent out for review.
>From gcc-bugs-return-447501-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Mar 26 06:35:12 2014
Return-Path: <gcc-bugs-return-447501-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 21640 invoked by alias); 26 Mar 2014 06:35:11 -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 21615 invoked by uid 48); 26 Mar 2014 06:35:06 -0000
From: "timo.teras at iki dot fi" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/58489] ICE: in reload_cse_simplify_operands, at postreload.c:411
Date: Wed, 26 Mar 2014 06:35:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: timo.teras at iki dot fi
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-58489-4-CJSD6BdltL@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58489-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58489-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-03/txt/msg02370.txt.bz2
Content-length: 539

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

--- Comment #2 from Timo Teräs <timo.teras at iki dot fi> ---
I got this fixed. It seems genautomata does not work properly if it is built
with -fPIC. Since PIE/PIC get added automatically in alpine toolchain it caused
this.

For now I'm adding explicitly -fno-PIC to genautomata compilation. However, it
would be better if genautomata could be fixed to:
 - abort compilation if genautomata failed to do it's job properly
 - fix genautomata to work even if compiled with -fPIC
>From gcc-bugs-return-447502-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Mar 26 06:47:08 2014
Return-Path: <gcc-bugs-return-447502-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 26059 invoked by alias); 26 Mar 2014 06:47:08 -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 26010 invoked by uid 55); 26 Mar 2014 06:47:04 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/59545] Signed integer overflow issues
Date: Wed, 26 Mar 2014 06:47:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: other
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mpolacek at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59545-4-ATdg3AaV21@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59545-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59545-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: 2014-03/txt/msg02371.txt.bz2
Content-length: 440

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY545

--- Comment #9 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Wed Mar 26 06:46:27 2014
New Revision: 208834

URL: http://gcc.gnu.org/viewcvs?rev 8834&root=gcc&view=rev
Log:
    PR other/59545
    * ira-color.c (update_conflict_hard_regno_costs): Perform the
    multiplication in unsigned type.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ira-color.c


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

end of thread, other threads:[~2015-02-01 22:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-26  6:06 [Bug rtl-optimization/60663] New: Errors out on valid inline asm zhenqiang.chen at linaro dot org
2014-04-10 16:32 ` [Bug rtl-optimization/60663] [4.9 Regression] " jakub at gcc dot gnu.org
2014-04-11 10:11 ` jakub at gcc dot gnu.org
2014-04-11 10:14 ` jakub at gcc dot gnu.org
2014-04-13 19:22 ` feedback at launchpad dot net
2014-04-15 14:04 ` ktkachov at gcc dot gnu.org
2014-06-12  9:14 ` yroux at gcc dot gnu.org
2015-01-23 19:56 ` jakub at gcc dot gnu.org
2015-02-01 17:33 ` jakub at gcc dot gnu.org
2015-02-01 22:00 ` jakub 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).