[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#429657: marked as done (gcc-4.1: optimisation bug abs() in nested if)



Your message dated Sat, 20 Oct 2007 07:47:04 +0000
with message-id <E1Ij932-0005da-Qi@ries.debian.org>
and subject line Bug#429657: fixed in gpc-4.1 2.1-4.1.2-17
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: gcc-4.1
Version: 4.1.1-21
Severity: normal


abuse-sdl-0.7.0 has a gun aiming problem due to a mis-optimisation.
attached is a canned example. 

(compile with -01 and -02 and compare the differences)


-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-686
Locale: LANG=en_NZ, LC_CTYPE=en_NZ (charmap=ISO-8859-1)

Versions of packages gcc-4.1 depends on:
ii  binutils               2.17cvs20070426-8 The GNU assembler, linker and bina
ii  cpp-4.1                4.1.1-21          The GNU C preprocessor
ii  gcc-4.1-base           4.1.1-21          The GNU Compiler Collection (base 
ii  libc6                  2.5-9+b1          GNU C Library: Shared libraries
ii  libgcc1                1:4.1.1-21        GCC support library
ii  libssp0                4.1.1-21          GCC stack smashing protection libr

Versions of packages gcc-4.1 recommends:
ii  libc6-dev                     2.5-9+b1   GNU C Library: Development Librari
pn  libmudflap0-dev               <none>     (no description available)

-- no debconf information
// example of GCC 4.1 optimisation bug 
// compile with -01 and -02 and compare the differences

// licence is  GPL2 - based on code taken from abuse-sdl

// gcc -o bad  example.c -O2 -lm
// gcc -o good example.c -O1 -lm


#include <stdio.h>
#include <math.h>

unsigned short atan_table[1662]={
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
    0,   0,   0,   0,   0,   0,   0,   1,   2,   3,   4,   5, 
    6,   6,   7,   8,   9,   9,  10,  11,  11,  12,  12,  13, 
   13,  14,  14,  15,  15,  16,  16,  17,  17,  18,  18,  18, 
   19,  19,  19,  20,  20,  20,  21,  21,  21,  22,  22,  22, 
   23,  23,  23,  23,  24,  24,  24,  24,  25,  25,  25,  25, 
   25,  26,  26,  26,  26,  26,  27,  27,  27,  27,  27,  28, 
   28,  28,  28,  28,  28,  28,  29,  29,  29,  29,  29,  29, 
   29,  30,  30,  30,  30,  30,  30,  30,  30,  31,  31,  31, 
   31,  31,  31,  31,  31,  31,  32,  32,  32,  32,  32,  32, 
   32,  32,  32,  32,  32,  33,  33,  33,  33,  33,  33,  33, 
   33,  33,  33,  33,  33,  33,  34,  34,  34,  34,  34,  34, 
   34,  34,  34,  34,  34,  34,  34,  34,  34,  35,  35,  35, 
   35,  35,  35,  35,  35,  35,  35,  35,  35,  35,  35,  35, 
   35,  35,  35,  35,  36,  36,  36,  36,  36,  36,  36,  36, 
   36,  36,  36,  36,  36,  36,  36,  36,  36,  36,  36,  36, 
   36,  36,  36,  37,  37,  37,  37,  37,  37,  37,  37,  37, 
   37,  37,  37,  37,  37,  37,  37,  37,  37,  37,  37,  37, 
   37,  37,  37,  37,  37,  37,  37,  37,  37,  38,  38,  38, 
   38,  38,  38,  38,  38,  38,  38,  38,  38,  38,  38,  38, 
   38,  38,  38,  38,  38,  38,  38,  38,  38,  38,  38,  38, 
   38,  38,  38,  38,  38,  38,  38,  38,  38,  38,  38,  38, 
   39,  39,  39,  39,  39,  39,  39,  39,  39,  39,  39,  39, 
   39,  39,  39,  39,  39,  39,  39,  39,  39,  39,  39,  39, 
   39,  39,  39,  39,  39,  39,  39,  39,  39,  39,  39,  39, 
   39,  39,  39,  39,  39,  39,  39,  39,  39,  39,  39,  39, 
   39,  39,  39,  39,  39,  39,  39,  39,  40,  40,  40,  40, 
   40,  40,  40,  40,  40,  40,  40,  40,  40,  40,  40,  40, 
   40,  40,  40,  40,  40,  40,  40,  40,  40,  40,  40,  40, 
   40,  40,  40,  40,  40,  40,  40,  40,  40,  40,  40,  40, 
   40,  40,  40,  40,  40,  40,  40,  40,  40,  40,  40,  40, 
   40,  40,  40,  40,  40,  40,  40,  40,  40,  40,  40,  40, 
   40,  40,  40,  40,  40,  40,  40,  40,  40,  40,  40,  40, 
   40,  40,  40,  40,  40,  40,  40,  41,  41,  41,  41,  41, 
   41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41, 
   41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41, 
   41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41, 
   41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41, 
   41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41, 
   41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41, 
   41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41, 
   41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41, 
   41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41, 
   41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41, 
   41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41,  41, 
   41,  41,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42,  42, 
   42,  42,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43,  43, 
   43,  43,  43,  44,  44,  44};

#define TBS (1662)
long lisp_atan2(long dy, long dx)
{
  if (dy==0)
  {
    if (dx>0) return 0;
    else return 180;
  } else if (dx==0)
  {
    if (dy>0) return 90;
    else return 270;
  } else
  {
    if (dx>0)
    {      
      if (dy>0)
      {
	if (abs(dx)>abs(dy))
	{
	  printf("case1:");	   
	  long a=dx*29/dy;
	  if (a>=TBS) return 0;
	  else return 45-atan_table[a];
	}
	else 
	{
	  printf("case2:");
	  long a=dy*29/dx;
	  if (a>=TBS) return 90;
	  else return 45+atan_table[a];
	}
      } else
      {
	if (abs(dx)>abs(dy))
	{
	  printf("case3:");
	  long a=dx*29/abs(dy);
	  if (a>=TBS)
	    return 0;
	  else
	    return 315+atan_table[a];
	}
	else
	{
	  printf("case4:");
	  long a=abs(dy)*29/dx;
	  if (a>=TBS)
	    return 260;
	  else
	    return 315-atan_table[a];
	}
      } 
    } else
    {
      if (dy>0)
      {
	if (abs(dx)>abs(dy))
	{
	  printf("case5:");
	  long a=-dx*29/dy;
	  if (a>=TBS)
	    return 135+45;
	  else
	    return 135+atan_table[a];
	}
	else 
	{
	  printf("case6:");
	  long a=dy*29/-dx;
	  if (a>=TBS)
	    return 135-45;
	  else
	    return 135-atan_table[a];
	}
      } else
      {
	if (abs(dx)>abs(dy))
	{
	  printf("case7:");
	  long a=-dx*29/abs(dy);
	  if (a>=TBS)
	    return 225-45;
	  else return 225-atan_table[a];
	}
	else 
	{
	  printf("case8:");
	  long a=abs(dy)*29/abs(dx);
	  if (a>=TBS)
	    return 225+45;	  
	  else return 225+atan_table[a];
	}
      } 
    }
  }  
}


int main()
{
   double angle;

   for( angle=M_PI/32; angle < M_PI * 2 ; angle+=M_PI/16)
     {
	double s=sin(angle) , c=cos(angle);
	
        long theta = lisp_atan2(s*100,c*100);
	
	printf ( " a=%4.0f theta=%4d %s\n",angle/M_PI * 180,theta, 
		 floor(0.5+angle/M_PI * 180 -theta)  ? "ERROR" : "ok");
     }
  return 0 ;
}

--- End Message ---
--- Begin Message ---
Source: gpc-4.1
Source-Version: 2.1-4.1.2-17

We believe that the bug you reported is fixed in the latest version of
gpc-4.1, which is due to be installed in the Debian FTP archive:

gpc-4.1-doc_2.1-4.1.2-17_all.deb
  to pool/main/g/gpc-4.1/gpc-4.1-doc_2.1-4.1.2-17_all.deb
gpc-4.1_2.1-4.1.2-17.diff.gz
  to pool/main/g/gpc-4.1/gpc-4.1_2.1-4.1.2-17.diff.gz
gpc-4.1_2.1-4.1.2-17.dsc
  to pool/main/g/gpc-4.1/gpc-4.1_2.1-4.1.2-17.dsc
gpc-4.1_2.1-4.1.2-17_i386.deb
  to pool/main/g/gpc-4.1/gpc-4.1_2.1-4.1.2-17_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 429657@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Matthias Klose <doko@debian.org> (supplier of updated gpc-4.1 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Fri, 19 Oct 2007 23:03:14 +0200
Source: gpc-4.1
Binary: gpc-4.1-doc gpc-4.1
Architecture: source i386 all
Version: 2.1-4.1.2-17
Distribution: unstable
Urgency: low
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Changed-By: Matthias Klose <doko@debian.org>
Description: 
 gpc-4.1    - The GNU Pascal compiler
 gpc-4.1-doc - Documentation for the GNU Pascal compiler (gpc)
Closes: 385580 388626 429657
Changes: 
 gpc-4.1 (2.1-4.1.2-17) unstable; urgency=low
 .
   * Upload as gpc-4.1
 .
 gcc-4.1 (4.1.2-17) unstable; urgency=low
 .
   [Matthias Klose]
   * Update to the gcc-4_1-branch 20071019.
     - Fix PR target/33256 (mips).
     - Fix PR tree-optimization/33142, wrong code with VRP through ABS_EXPR.
       Closes: #429657.
     - Fix PR c++/29226, ICE in make_decl_rtl (closes: #388626).
     - Fix PR target/31641, ICE in s390_expand_setmem (closes: #385580).
   * Set the priority of the source package to optional.
   * Remove .la files from the biarch libstdc++ debug packages,
     conflict with the 3.4 package. Addresses: #440490.
   * Update Hurd fixes (Samuel Thibault).
   * When -fstack-protector is the default (Ubuntu), do not enable
     -fstack-protector when -nostdlib is specified. LP: #77865.
   * Add -g to BOOT_CFLAGS, set STAGE1_CFLAGS to -g -O, only pass
     other settings when required.
   * Fix installation of the s390 libstdc++ biarch headers.
   * Allow the powerpc build on a 32bit machine (without running the
     biarch testsuite).
   * Add niagara2 optimization support (David Miller).
 .
   * Only remove libgcj7's classmap db if no other libgcj7* library is
     installed.
   * Disable building gcj for mipsel.
 .
   * Update gpc to CVS 20070904.
   * debian/copyright: gpc is now licensed under the GPL3. The gpc
     changes are only found in the gpc-4.1 sources.
   * Loosen dependency of gpc-4.1 on gcc-4.1. LP: #145561.
 .
   [Arthur Loiret]
   * Port on k*bsd*-gnu:
     - Apply Debian patch in upstream SVN. (target-ver-syms.sh,
       phobos/acinclude.m4, phobos/configure.in)
     - debian/control.m4: add kfreebsd-i386 and kfreebsd-amd64 to gdc
       Architecture list.
   * svn-gdc-updates.dpatch: Update to SVN 20070914.
     - Merge DMD 1.021
     - dmd-script, d-spec.c (lang_specific_driver): Support -debuglib= and
       -defaultlib= options.
     - phobos/std/stdio.d (readln): Use the result of getdelim correctly.
       (SF 1788195)
     - d-glue.cc (FuncDeclaration::toObjFile): Do not gimplify if there were
       errors. (Bugzilla 1415)
     - d-objfile.cc (outdata): Do not set TREE_CONSTANT on initializers.
       (Bugzilla 1453)
     -  phobos/std/c/stdio.d: Define fpos_t correctly for Drawin.
        (Bugzilla 1469)
     - d-codegen.{h, cc}, d-glue.cc: Change rawArray to toDArray. Do
       not cast result to void[]. (Bugzilla 1490)
     - d-glue.cc, d-codegen.h, d-codegen.cc: Make it an error
       to reference a nested function without a body. (SF 1793594)
     - d-codegen.cc (convertTo, call): Prevent multiple re-evaluation
       of delgate. (Bugzilla 1492)
 .
   * debian/rules.d/binary-d.mk: Add $(DEB_TARGET_GNU_TYPE) symlinks for
     gdc/gdmd binaries.
   * gdc-sqrt-double-cast.dpatch: disable (not removed yet) in rules.patch,
     should be fixed upstream.
 .
   [Ludovic Brenta]
   * Disable building libgnatprj-dev and libgnatvsn-dev; now provided by
     gnat-4.2.
Files: 
 655dcb54b7bbc149c7c590479167f50a 2054 devel optional gpc-4.1_2.1-4.1.2-17.dsc
 7cfdf6b2c3352d3cf84573b5c409a514 1652420 devel optional gpc-4.1_2.1-4.1.2-17.diff.gz
 9c8a6140b36881379ebd5aa4e5679816 1010766 doc optional gpc-4.1-doc_2.1-4.1.2-17_all.deb
 8287e6fb2f64492e6739e5a879186a80 3088522 devel optional gpc-4.1_2.1-4.1.2-17_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHGTmzStlRaw+TLJwRArnKAKCFBhjQfwAx+TeU3ML7XUtzqz2hrACeIMPG
SoNDnqOJsyow3Q3VaO5VfFE=
=Oykd
-----END PGP SIGNATURE-----



--- End Message ---

Reply to: