public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/5420: bad code generated with gcc3.1/ia64
@ 2002-01-17 18:56 David Mosberger
  0 siblings, 0 replies; 3+ messages in thread
From: David Mosberger @ 2002-01-17 18:56 UTC (permalink / raw)
  To: gcc-gnats; +Cc: davidm


>Number:         5420
>Category:       c
>Synopsis:       bad code generated with gcc3.1/ia64
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 17 18:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     David Mosberger
>Release:        3.1 20020117 (experimental)
>Organization:
HP Labs
>Environment:
System: Linux wailua.hpl.hp.com 2.4.17 #2 SMP Thu Jan 17 13:53:26 PST 2002 ia64 unknown
Architecture: ia64

	ia64, Linux, ia64
host: ia64-hp-linux-gnu
build: ia64-hp-linux-gnu
target: ia64-hp-linux-gnu
configured with: ../gcc/configure --prefix=/opt/gcc3.1 --host=ia64-hp-linux : (reconfigured) 
>Description:
	On the attached test program, gcc generates bad code with
	an optimization level of -O2.  -O works fine.
>How-To-Repeat:
	$ gcc -O2 test.c
	$ ./a.out
	./a.out 
	dev=1220
	dev=1220

This is wrong.  The correct output should be:

	dev=800
	dev=810

>Fix:
	The workaround is to drop the optimization level to -O.

<-- test.c --><-- test.c --><-- test.c --><-- test.c -->
typedef struct {
	unsigned short value;
} kdev_t;

#define mk_kdev(major, minor)	((kdev_t) { (((major) << 8) + (minor)) } )

#define SD_MAJOR(i)		(!(i) ? 8 : 65-1+(i))
#define MKDEV_SD_PARTITION(i)	mk_kdev(SD_MAJOR((i) >> 8), (i))

int
main (int argc, char **argv)
{
	int idx;

	for (idx = 0; idx < 2; ++idx)
		printf ("dev=%x\n", MKDEV_SD_PARTITION((idx) << 4).value);
}
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c/5420: bad code generated with gcc3.1/ia64
@ 2002-02-22 20:38 rodrigc
  0 siblings, 0 replies; 3+ messages in thread
From: rodrigc @ 2002-02-22 20:38 UTC (permalink / raw)
  To: davidm, gcc-bugs, gcc-prs, jakub

Synopsis: bad code generated with gcc3.1/ia64

State-Changed-From-To: open->closed
State-Changed-By: rodrigc
State-Changed-When: Fri Feb 22 20:34:58 2002
State-Changed-Why:
    http://gcc.gnu.org/ml/gcc-patches/2002-02/msg00477.html

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5420


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

* Re: c/5420: bad code generated with gcc3.1/ia64
@ 2002-02-06  5:25 jakub
  0 siblings, 0 replies; 3+ messages in thread
From: jakub @ 2002-02-06  5:25 UTC (permalink / raw)
  To: davidm, gcc-bugs, gcc-prs, jakub, nobody

Synopsis: bad code generated with gcc3.1/ia64

Responsible-Changed-From-To: unassigned->jakub
Responsible-Changed-By: jakub
Responsible-Changed-When: Wed Feb  6 05:25:34 2002
Responsible-Changed-Why:
    This is problem with COMPOUND_LITERAL reevaluation during
    tail call optimization. Will post a patch.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5420


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

end of thread, other threads:[~2002-02-23  4:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-17 18:56 c/5420: bad code generated with gcc3.1/ia64 David Mosberger
2002-02-06  5:25 jakub
2002-02-22 20:38 rodrigc

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