public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11689] New: g++3.3 emmits un-assembleable code for k6 architecture
@ 2003-07-27 21:38 thor at math dot tu-berlin dot de
  2003-07-27 22:07 ` [Bug target/11689] " pinskia at physics dot uc dot edu
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: thor at math dot tu-berlin dot de @ 2003-07-27 21:38 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: g++3.3 emmits un-assembleable code for k6 architecture
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: thor at math dot tu-berlin dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-pc-linux-gnu
  GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu

Save the following code as foo.cpp:

/* snip */
class JKeeper {
public:
  unsigned long a0;
};

class EBCOTLut : public JKeeper {
  unsigned char a1[1<<8];   
  unsigned char a2[1<<8];
  unsigned char a3[1<<8];
  long          a4[1<<9];
public:
  EBCOTLut(void);
};

EBCOTLut::EBCOTLut(void)
{
  unsigned char inter[36];   // intermediate lookup table;
  unsigned long i;
  for(i=0;i<36;i++) {
    inter[i] = 0;
  }
  for(i=1;i<16;i++) {
    a1[i | (1<<7)] = 8<<1;
    a1[i | (1<<6)] = 8<<1;
  }
  for(i=0;i < ((1<<9)-1);i++) {
    int ds = (i>>0) & 0x01;    // significance of DOWN
    int us = (i>>1) & 0x01;    // significance of UP
    int rs = (i>>2) & 0x01;    // significance of RIGHT
    int ls = (i>>3) & 0x01;    // significance of LEFT
    int dn = (i>>5) & 0x01;    // sign of DOWN
    int un = (i>>6) & 0x01;    // sign of UP
    int rn = (i>>7) & 0x01;    // sign of RIGHT
    int ln = (i>>8) & 0x01;    // sign of LEFT
    int h,v;                   // h and v as in the VM description

    h = ls*(1-ln*2) + rs*(1-2*rn);
    v = us*(1-un*2) + ds*(1-2*dn);
    h = (h >= -1)?(h):(-1);
    v = (v >= -1)?(v):(-1);
    h = (h <=  1)?(h):(1);
    v = (v <=  1)?(v):(1);
    a2[i] = inter[((h+1)<<3) | (v+1)];
    a3[i] = inter[((h+1)<<3) | (v+1)] & (unsigned char)(~1);
  }
  for(i=0;i< 1<<9; i++) {
    a4[i]    = 2*(i-(1<<(9-1)))*(i-(1<<(9-1))) - 
      ((i< (1<<(9-1)))?
       (2*(i-(1<<(9-2)))*(i-(1<<(9-2)))):
       (2*(i-(3<<(9-2)))*(i-(3<<(9-2)))));

  }
}
/* snip */

Then compile as follows:

g++-3.3 -c -O3 -funroll-loops -mcpu=k6 -fomit-frame-pointer foo.cpp

The result of this is:

/tmp/ccDJ3xI4.s: Assembler messages:
/tmp/ccDJ3xI4.s:85: Error: value of ffffffffffffff7a too large for field of 1
bytes at 000000000000010b
/tmp/ccDJ3xI4.s:355: Error: value of ffffffffffffff7a too large for field of 1
bytes at 00000000000004ab

Thus, the gcc compiler generates unsuitable code for the assembler.
The offending assembly lines contain a .loop statement with a branch target that
seems likely to be too large.


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

* [Bug target/11689] g++3.3 emmits un-assembleable code for k6 architecture
  2003-07-27 21:38 [Bug c++/11689] New: g++3.3 emmits un-assembleable code for k6 architecture thor at math dot tu-berlin dot de
@ 2003-07-27 22:07 ` pinskia at physics dot uc dot edu
  2003-09-01  3:36 ` [Bug target/11689] g++3.3 emits " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-27 22:07 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c++                         |target
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2003-07-27 22:07:40
               date|                            |


------- Additional Comments From pinskia at physics dot uc dot edu  2003-07-27 22:07 -------
I can confirm this on 3.3.1 (20030707).  On the mainline, the unroller is useless for the "doloop" 
optimization so it is not reproducable there.
In 3.2.3 or 3.0.4 or 2.95.3, the "doloop" optimization does not happen for some reason.


The workaround for 3.3 is to use -fno-branch-count-reg.


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

* [Bug target/11689] g++3.3 emits un-assembleable code for k6 architecture
  2003-07-27 21:38 [Bug c++/11689] New: g++3.3 emmits un-assembleable code for k6 architecture thor at math dot tu-berlin dot de
  2003-07-27 22:07 ` [Bug target/11689] " pinskia at physics dot uc dot edu
@ 2003-09-01  3:36 ` pinskia at gcc dot gnu dot org
  2003-09-01  8:26 ` ebotcazou at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-01  3:36 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vvas at hal dot csd dot auth
                   |                            |dot gr


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-09-01 03:36 -------
*** Bug 12116 has been marked as a duplicate of this bug. ***


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

* [Bug target/11689] g++3.3 emits un-assembleable code for k6 architecture
  2003-07-27 21:38 [Bug c++/11689] New: g++3.3 emmits un-assembleable code for k6 architecture thor at math dot tu-berlin dot de
  2003-07-27 22:07 ` [Bug target/11689] " pinskia at physics dot uc dot edu
  2003-09-01  3:36 ` [Bug target/11689] g++3.3 emits " pinskia at gcc dot gnu dot org
@ 2003-09-01  8:26 ` ebotcazou at gcc dot gnu dot org
  2003-09-08  6:41 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-09-01  8:26 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ebotcazou at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Target Milestone|3.4                         |3.3.2


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-09-01 08:26 -------
I will shortly be investigating.


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

* [Bug target/11689] g++3.3 emits un-assembleable code for k6 architecture
  2003-07-27 21:38 [Bug c++/11689] New: g++3.3 emmits un-assembleable code for k6 architecture thor at math dot tu-berlin dot de
                   ` (2 preceding siblings ...)
  2003-09-01  8:26 ` ebotcazou at gcc dot gnu dot org
@ 2003-09-08  6:41 ` cvs-commit at gcc dot gnu dot org
  2003-09-08  6:46 ` cvs-commit at gcc dot gnu dot org
  2003-09-08  6:51 ` ebotcazou at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-09-08  6:41 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-09-08 06:41 -------
Subject: Bug 11689

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	ebotcazou@gcc.gnu.org	2003-09-08 06:41:50

Modified files:
	gcc            : ChangeLog 
	gcc/config/i386: i386.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/opt: longbranch2.C 

Log message:
	PR target/11689
	* config/i386/i386.c (memory_address_length): Fix computation when
	the base is esp or ebp.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1001&r2=2.1002
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&r1=1.599&r2=1.600
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3038&r2=1.3039
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/longbranch2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1


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

* [Bug target/11689] g++3.3 emits un-assembleable code for k6 architecture
  2003-07-27 21:38 [Bug c++/11689] New: g++3.3 emmits un-assembleable code for k6 architecture thor at math dot tu-berlin dot de
                   ` (3 preceding siblings ...)
  2003-09-08  6:41 ` cvs-commit at gcc dot gnu dot org
@ 2003-09-08  6:46 ` cvs-commit at gcc dot gnu dot org
  2003-09-08  6:51 ` ebotcazou at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-09-08  6:46 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-09-08 06:46 -------
Subject: Bug 11689

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	ebotcazou@gcc.gnu.org	2003-09-08 06:46:44

Modified files:
	gcc            : ChangeLog 
	gcc/config/i386: i386.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/opt: longbranch2.C 

Log message:
	PR target/11689
	* config/i386/i386.c (memory_address_length): Fix computation when
	the base is esp or ebp.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.729&r2=1.16114.2.730
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.495.2.25&r2=1.495.2.26
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.273&r2=1.2261.2.274
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/longbranch2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1


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

* [Bug target/11689] g++3.3 emits un-assembleable code for k6 architecture
  2003-07-27 21:38 [Bug c++/11689] New: g++3.3 emmits un-assembleable code for k6 architecture thor at math dot tu-berlin dot de
                   ` (4 preceding siblings ...)
  2003-09-08  6:46 ` cvs-commit at gcc dot gnu dot org
@ 2003-09-08  6:51 ` ebotcazou at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-09-08  6:51 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-09-08 06:51 -------
See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00357.html


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

end of thread, other threads:[~2003-09-08  6:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-27 21:38 [Bug c++/11689] New: g++3.3 emmits un-assembleable code for k6 architecture thor at math dot tu-berlin dot de
2003-07-27 22:07 ` [Bug target/11689] " pinskia at physics dot uc dot edu
2003-09-01  3:36 ` [Bug target/11689] g++3.3 emits " pinskia at gcc dot gnu dot org
2003-09-01  8:26 ` ebotcazou at gcc dot gnu dot org
2003-09-08  6:41 ` cvs-commit at gcc dot gnu dot org
2003-09-08  6:46 ` cvs-commit at gcc dot gnu dot org
2003-09-08  6:51 ` ebotcazou at gcc dot gnu dot 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).