Bug 54037 - Using -O flag changes behaviour of program
Summary: Using -O flag changes behaviour of program
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 8.0
Hardware: i386
OS: Linux
medium
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-09-26 10:11 UTC by Pedro Miguel Marques Morais
Modified: 2007-04-18 16:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-02 00:19:36 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Source code (754 bytes, text/plain)
2001-09-26 10:16 UTC, Pedro Miguel Marques Morais
no flags Details
Makefile (623 bytes, text/plain)
2001-09-26 10:17 UTC, Pedro Miguel Marques Morais
no flags Details

Description Pedro Miguel Marques Morais 2001-09-26 10:11:57 UTC
Description of Problem:

In the attached file, compiling the program with and without -O changes the
warnings given. Also, the compiler performs an invalid optimization, that
is,
code without -O runs fine, code with -O core dumps

Version-Release number of selected component (if applicable):

It also happens using gcc3.

How Reproducible:

Always

Steps to Reproduce:
1. Get the two attached files, test.c and Makefile
2. make

Actual Results:

Two warnings, Two core dumps

Expected Results:

No warnings or core dumps OR 4 warnings and 4 core dumps:
consistent behaviour between -O and no -O

Comment 1 Pedro Miguel Marques Morais 2001-09-26 10:16:40 UTC
Created attachment 32638 [details]
Source code

Comment 2 Pedro Miguel Marques Morais 2001-09-26 10:17:47 UTC
Created attachment 32639 [details]
Makefile

Comment 3 Alan Cox 2002-12-15 17:49:43 UTC
still true in gcc 3.2


Comment 4 Richard Henderson 2004-10-02 00:19:36 UTC
This is invalid code.  Only const references may be bound to
temporaries.  You may find some commentary useful at

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


Note You need to log in before you can comment on or make changes to this bug.