public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: rossc@cs.colostate.edu
To: gcc-gnats@gcc.gnu.org
Subject: c/2635: Incorrect output in SIMPLE program when using -O2 (Both Linux and Solaris) gcc version 2.95.2 19991024 (release)gcc version 2.95.2 19991024 (release)
Date: Wed, 25 Apr 2001 05:06:00 -0000	[thread overview]
Message-ID: <20010425120517.25305.qmail@sourceware.cygnus.com> (raw)

>Number:         2635
>Category:       c
>Synopsis:       Incorrect output in SIMPLE program when using -O2 (Both Linux and Solaris) gcc version 2.95.2 19991024 (release)gcc version 2.95.2 19991024 (release)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 25 05:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Charles Ross (rossc@cs.colostate.edu)
>Release:        gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
Redhat Linux 6.2 (kernel 2.2.17-14) AND Solaris 5.8
These are the only two I have tested it on, 
so I assume it is a platform independant bug.
>Description:
I have created a small (19 line) example which includes
NO other files.

The program is quite simple.  Note that it is basically
4 copies of the same 3 line program interlaced.. If you 
replicate it further (ie: 100 copies of the same 3 line
program interlaced), then the ouput gets even stranger I
have made a meta program which generates them. I am 
including it as well in b.c, but I doubt you'll need it.

There need to be 4 (or more) copies in the linux version 
to show the error, but the solaris version shows it with
only 1 copy.

It was origionally a piece of code which was doing page
size calculations.. 4096 is the page size on linux, and
I was attempting to compute the number of pages needed for
a piece of data.  Hoever I was able to decompose it down to
this code.


The output is correct when no optimizations are used,
but fail when -O2 is used.
Output is different on Linux and solaris when -O2 is used,
but both are incorrect.

I have included the .c file (a.c)
(no .i file, cause there are no includes)
and the output when using the -v option (a.v)
the a.v file was generated under linux.
>How-To-Repeat:
gcc -O2 a.c
a.out

>Fix:
Um... dont use -O2 I guess... but that seems more like
a cheezy workarround than a fix.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="b.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="b.c"


             reply	other threads:[~2001-04-25  5:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-25  5:06 rossc [this message]
2001-06-09  7:30 jsm28

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010425120517.25305.qmail@sourceware.cygnus.com \
    --to=rossc@cs.colostate.edu \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).