public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15020] New: -mcpu=pentium4 generates wrong code
@ 2004-04-20  9:12 stl at caltech dot edu
  2004-04-20  9:17 ` [Bug c++/15020] " stl at caltech dot edu
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: stl at caltech dot edu @ 2004-04-20  9:12 UTC (permalink / raw)
  To: gcc-bugs

I observe that -mcpu=pentium4 is breaking my code. (And I /think/ my code 
isn't buggy.)

C:\Temp>g++ -O2 -mcpu=pentium4 huff_test.ii -o huff_test.exe

C:\Temp>huff_test.exe double.cc

C:\Temp>g++ -O2 huff_test.ii -o huff_test.exe

C:\Temp>huff_test.exe double.cc
Beginning of tests.
Success.
Original Size:    300
Huffed Size:      426
Bits Per Byte:    11.36
Huff Speed:       0.24779 MB/s
Puff Speed:       0.404949 MB/s
Before Huff Fixed
After Huff Fixed
Huff Fixed Size: 426
Success.
Before Puff Fixed
After Puff Fixed
Success.
Huff Fixed Speed: 0.0756252 MB/s
Puff Fixed Speed: 0.0204231 MB/s
End of tests.

C:\Temp>g++ --version
g++ (GCC) 3.3.3 (mingw special)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


C:\Temp>

-- 
           Summary: -mcpu=pentium4 generates wrong code
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stl at caltech dot edu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-mingw32
  GCC host triplet: i686-pc-mingw32
GCC target triplet: i686-pc-mingw32


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


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

* [Bug c++/15020] -mcpu=pentium4 generates wrong code
  2004-04-20  9:12 [Bug c++/15020] New: -mcpu=pentium4 generates wrong code stl at caltech dot edu
@ 2004-04-20  9:17 ` stl at caltech dot edu
  2004-04-20  9:24 ` stl at caltech dot edu
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: stl at caltech dot edu @ 2004-04-20  9:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From stl at caltech dot edu  2004-04-20 09:06 -------
Created an attachment (id=6118)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6118&action=view)
bzip2ed preprocessed source


-- 


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


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

* [Bug c++/15020] -mcpu=pentium4 generates wrong code
  2004-04-20  9:12 [Bug c++/15020] New: -mcpu=pentium4 generates wrong code stl at caltech dot edu
  2004-04-20  9:17 ` [Bug c++/15020] " stl at caltech dot edu
@ 2004-04-20  9:24 ` stl at caltech dot edu
  2004-04-20  9:34 ` stl at caltech dot edu
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: stl at caltech dot edu @ 2004-04-20  9:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From stl at caltech dot edu  2004-04-20 09:07 -------
Created an attachment (id=6119)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6119&action=view)
Example Input File (Contents Irrelevant)

The contents of this file are irrelevant; I observe the crash to happen on
every input file I've tried. I had this snippet lying around.

-- 


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


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

* [Bug c++/15020] -mcpu=pentium4 generates wrong code
  2004-04-20  9:12 [Bug c++/15020] New: -mcpu=pentium4 generates wrong code stl at caltech dot edu
  2004-04-20  9:17 ` [Bug c++/15020] " stl at caltech dot edu
  2004-04-20  9:24 ` stl at caltech dot edu
@ 2004-04-20  9:34 ` stl at caltech dot edu
  2004-04-20 13:14 ` bangerth at dealii dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: stl at caltech dot edu @ 2004-04-20  9:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From stl at caltech dot edu  2004-04-20 09:09 -------
The first time huff_test.exe is run above, it segfaults in Windows. That's why 
no output is generated.

-- 


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


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

* [Bug c++/15020] -mcpu=pentium4 generates wrong code
  2004-04-20  9:12 [Bug c++/15020] New: -mcpu=pentium4 generates wrong code stl at caltech dot edu
                   ` (2 preceding siblings ...)
  2004-04-20  9:34 ` stl at caltech dot edu
@ 2004-04-20 13:14 ` bangerth at dealii dot org
  2004-04-20 16:39 ` stl at caltech dot edu
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2004-04-20 13:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-04-20 12:48 -------
When trying to compile your code, I get a lot of linker errors, 
along the lines 
 
g/x> /home/bangerth/bin/gcc-3.3.4-pre/bin/c++ -O2 x.ii  
/tmp/ccIhSiao.o(.text+0x17b): In function `main': 
: undefined reference to `QueryPerformanceCounter' 
... 
/tmp/ccIhSiao.o(.gnu.linkonce.t._ZN5nuwen10input_file12extract_restEv+0x6a4): 
In function `nuwen::input_file::extract_rest()': 
: undefined reference to `_filbuf' 
/tmp/
ccIhSiao.o(.gnu.linkonce.t._ZN5boost6detail20sp_counted_base_implIPN4pham10proto_fileENS_15checked_deleterIS3_EEE11get_deleterERKSt9type_info
+0x16): In function `boost::detail::sp_counted_base_impl<pham::proto_file*, 
boost::checked_deleter<pham::proto_file> >::get_deleter(std::type_info 
const&)': 
: undefined reference to `std::type_info::operator==(std::type_info const&) 
const' 
 
Can you say how we need to link this file? 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug c++/15020] -mcpu=pentium4 generates wrong code
  2004-04-20  9:12 [Bug c++/15020] New: -mcpu=pentium4 generates wrong code stl at caltech dot edu
                   ` (3 preceding siblings ...)
  2004-04-20 13:14 ` bangerth at dealii dot org
@ 2004-04-20 16:39 ` stl at caltech dot edu
  2004-04-20 16:55 ` [Bug target/15020] " bangerth at dealii dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: stl at caltech dot edu @ 2004-04-20 16:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From stl at caltech dot edu  2004-04-20 16:23 -------
The first huff_test.ii.bz2 needs to be linked on MinGW gcc 3.3.3 to generate 
the error (I haven't tried other versions).

Following is a preprocessed version created with "gcc (GCC) 3.2.2 20030222 
(Red Hat Linux 3.2.2-5)". However, when I compile it with that compiler and 
run it, I cannot reproduce the bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
     Ever Confirmed|                            |1


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


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

* [Bug target/15020] -mcpu=pentium4 generates wrong code
  2004-04-20  9:12 [Bug c++/15020] New: -mcpu=pentium4 generates wrong code stl at caltech dot edu
                   ` (4 preceding siblings ...)
  2004-04-20 16:39 ` stl at caltech dot edu
@ 2004-04-20 16:55 ` bangerth at dealii dot org
  2004-04-21  1:29 ` rridge at csclub dot uwaterloo dot ca
  2004-04-24  5:38 ` rridge at csclub dot uwaterloo dot ca
  7 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2004-04-20 16:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-04-20 16:42 -------
OK, thanks. I must be something target dependent then. 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |target


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


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

* [Bug target/15020] -mcpu=pentium4 generates wrong code
  2004-04-20  9:12 [Bug c++/15020] New: -mcpu=pentium4 generates wrong code stl at caltech dot edu
                   ` (5 preceding siblings ...)
  2004-04-20 16:55 ` [Bug target/15020] " bangerth at dealii dot org
@ 2004-04-21  1:29 ` rridge at csclub dot uwaterloo dot ca
  2004-04-24  5:38 ` rridge at csclub dot uwaterloo dot ca
  7 siblings, 0 replies; 9+ messages in thread
From: rridge at csclub dot uwaterloo dot ca @ 2004-04-21  1:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rridge at csclub dot uwaterloo dot ca  2004-04-21 01:26 -------
The bug is caused by GCC moving instructions that writs to the stack
(part of the exception frame setup) to before the call that probes the stack.
 
The following test case demonstrates the problem with both on GCC 3.3.3 as
well as 3.5.0 (HEAD).  Compile with "g++ -O2 -mcpu=pentium4" or
"g++ -O2 -mtune=pentium4" as appropriate for the release.

int
foo() {
	throw 1;
}


int
main(int argc, char **) {
	char buf[1 * 1024 * 1024];
	int r = argc;
	
	/* Clobber ESI, EDI, EBP so they get pushed on the stack
	   in the prologue */
	
	asm("/* */" : "=D" (r) : "0" (r));
	asm("/* */" : "=S" (r) : "0" (r));
	asm("/* */" : "=b" (r) : "0" (r));

	try {
		foo();
	} catch(...) {
		r = 0;
	}
	return r;
}


-- 


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


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

* [Bug target/15020] -mcpu=pentium4 generates wrong code
  2004-04-20  9:12 [Bug c++/15020] New: -mcpu=pentium4 generates wrong code stl at caltech dot edu
                   ` (6 preceding siblings ...)
  2004-04-21  1:29 ` rridge at csclub dot uwaterloo dot ca
@ 2004-04-24  5:38 ` rridge at csclub dot uwaterloo dot ca
  7 siblings, 0 replies; 9+ messages in thread
From: rridge at csclub dot uwaterloo dot ca @ 2004-04-24  5:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rridge at csclub dot uwaterloo dot ca  2004-04-24 02:38 -------
It looks like the allocate_stack_worker instructions need the guards the
pro_epilogue_adjust_stack instructions have to prevent instructions
that use the frame pointer from being moved around these instructions.
They should also probably get the RTX_FRAME_RELATED_P flags that the
pro_epilogue_adjust_stack instructions get.


-- 


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


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

end of thread, other threads:[~2004-04-24  2:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-20  9:12 [Bug c++/15020] New: -mcpu=pentium4 generates wrong code stl at caltech dot edu
2004-04-20  9:17 ` [Bug c++/15020] " stl at caltech dot edu
2004-04-20  9:24 ` stl at caltech dot edu
2004-04-20  9:34 ` stl at caltech dot edu
2004-04-20 13:14 ` bangerth at dealii dot org
2004-04-20 16:39 ` stl at caltech dot edu
2004-04-20 16:55 ` [Bug target/15020] " bangerth at dealii dot org
2004-04-21  1:29 ` rridge at csclub dot uwaterloo dot ca
2004-04-24  5:38 ` rridge at csclub dot uwaterloo dot ca

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