public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/63358] New: [4.8.3 - 4.9.1] gcc -O2/-O3 wrong assembly code (crash / Segmentation fault)
@ 2014-09-24 13:03 jean-baptiste.laurent at epitech dot eu
  2014-09-24 13:09 ` [Bug c/63358] " trippels at gcc dot gnu.org
  2014-09-24 13:41 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: jean-baptiste.laurent at epitech dot eu @ 2014-09-24 13:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63358
           Summary: [4.8.3 - 4.9.1] gcc -O2/-O3 wrong assembly code (crash
                    / Segmentation fault)
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jean-baptiste.laurent at epitech dot eu

Created attachment 33547
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33547&action=edit
The zip file containing the small code making gcc generate wrong assembly, and
both the .s and .i generated by -save-temps.

Hi,

It appears that gcc, when compiling the code in attachment generate an assembly
which is wrong.

This code has been tested with gcc 4.7.1 (working), 4.8.3 (crash) on Fedora 18
and Fedora 20, and 4.9.1 (crash) on Ubuntu 14.04.

The source file produce a wrong code when compiling with at least -O2. Warning
flags (-W -Wall -Wextra) do not influence the result. There are no warning
generated.

When looking at the assembly directly it look like there is a whole part of the
code missing (like the compilation stopped but do not failed).


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

* [Bug c/63358] [4.8.3 - 4.9.1] gcc -O2/-O3 wrong assembly code (crash / Segmentation fault)
  2014-09-24 13:03 [Bug c/63358] New: [4.8.3 - 4.9.1] gcc -O2/-O3 wrong assembly code (crash / Segmentation fault) jean-baptiste.laurent at epitech dot eu
@ 2014-09-24 13:09 ` trippels at gcc dot gnu.org
  2014-09-24 13:41 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-09-24 13:09 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |trippels at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
From https://gcc.gnu.org/bugs/:
»if compiling with -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations makes a difference, your code probably is
not correct.«

markus@x4 tmp % gcc -fsanitize=undefined -Wall -Wextra -O2 main.i
markus@x4 tmp % ./a.out
I = 0, Result = 0
I = 1, Result = 1234567890
main.c:12:11: runtime error: signed integer overflow: 2 * 1234567890 cannot be
represented in type 'int'
>From gcc-bugs-return-462427-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Sep 24 13:25:00 2014
Return-Path: <gcc-bugs-return-462427-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 32576 invoked by alias); 24 Sep 2014 13:25:00 -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 32553 invoked by uid 48); 24 Sep 2014 13:24:55 -0000
From: "jean-baptiste.laurent at epitech dot eu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/63358] [4.8.3 - 4.9.1] gcc -O2/-O3 wrong assembly code (crash / Segmentation fault)
Date: Wed, 24 Sep 2014 13:25:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.9.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: major
X-Bugzilla-Who: jean-baptiste.laurent at epitech dot eu
X-Bugzilla-Status: RESOLVED
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-63358-4-GrTp7pRD4K@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-63358-4@http.gcc.gnu.org/bugzilla/>
References: <bug-63358-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-09/txt/msg02261.txt.bz2
Content-length: 214

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

--- Comment #2 from jean-baptiste.laurent at epitech dot eu ---
Thanks for the quick answer. The overflow is not only supposed to alter the
result printed out ?


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

* [Bug c/63358] [4.8.3 - 4.9.1] gcc -O2/-O3 wrong assembly code (crash / Segmentation fault)
  2014-09-24 13:03 [Bug c/63358] New: [4.8.3 - 4.9.1] gcc -O2/-O3 wrong assembly code (crash / Segmentation fault) jean-baptiste.laurent at epitech dot eu
  2014-09-24 13:09 ` [Bug c/63358] " trippels at gcc dot gnu.org
@ 2014-09-24 13:41 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2014-09-24 13:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Signed integer overflow is undefined behaviour, so anything can happen.

Specifically, the compiler is allowed to assume that overflow never happens,
and perform optimisations based on that assumption, so if overflow *does*
happen the results are unpredictable.


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

end of thread, other threads:[~2014-09-24 13:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-24 13:03 [Bug c/63358] New: [4.8.3 - 4.9.1] gcc -O2/-O3 wrong assembly code (crash / Segmentation fault) jean-baptiste.laurent at epitech dot eu
2014-09-24 13:09 ` [Bug c/63358] " trippels at gcc dot gnu.org
2014-09-24 13:41 ` redi 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).