🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1005

Two bugs within gcc-2.2.2

#1005
From: Sebastian Wangnick
Date: Thu, 27 Aug 1992 18:21
83 lines
3160 bytes
I just reinstalled gcc-2.2.2 on our RS6000 (configured rs6000-ibm-aix) and
stumbled again over this damn bug within __builtin_new of libgcc2.c:
Allocating e.g., new int[0], fires the new_handler! I patched this with:

*** libgcc2.c  Thu Aug 27 15:46:30 1992
--- /tmp/lc Thu Aug 27 15:54:20 1992
***************
*** 969,975 ****
  {
    void *p;
    p = malloc (sz);
!   if (p == 0 && sz)
      (*__new_handler) ();
    return p;
  }
--- 969,975 ----
  {
    void *p;
    p = malloc (sz);
!   if (p == 0)
      (*__new_handler) ();
    return p;
  }


Another issue is that using -pg makes the assembler complain (at least in 
AIX 3.2 with the patch you mention in RS6000.README installed): Compiling 
the following program

	int main () {return 0;}

with
	gcc -pg -v -c minimal.C

leads to:
Reading specs from /usr/local/lib/gcc-lib/rs6000-ibm-aix/2.2.2/specs
gcc version 2.2.2
 /usr/local/lib/gcc-lib/rs6000-ibm-aix/2.2.2/cpp -lang-c++ -v -undef -D__GNUC__=
2 -D__GNUG__=2 -D__cplusplus -D_IBMR2 -D_AIX -D___IBMR2__ -D___AIX__ -D___IBMR2
-D___AIX -D__CHAR_UNSIGNED__ minimal.C /tmp/ccWcMDM2.i
GNU CPP version 2.2.2
 /usr/local/lib/gcc-lib/rs6000-ibm-aix/2.2.2/cc1plus /tmp/ccWcMDM2.i -quiet -dum
pbase minimal.cc -version -p -o /tmp/ccWcMDM2.s
GNU C++ version 2.2.2 compiled by GNU C version 2.2.2.
 as -o minimal.o /tmp/ccWcMDM2.s
Assembler:
/tmp/ccWcMDM2.s: line 1: Invalid toc entry within .toc scope
/tmp/ccWcMDM2.s: line 24: Invalid toc entry within .toc scope
/tmp/ccWcMDM2.s: line 30: undefined symbol ".mcount"
/tmp/ccWcMDM2.s: line 30: illegal expression type for branch address

I overcame this with the following patch to toplev.c (not knowing what it will 
do to other architectures):

*** toplev.c    Thu Aug 27 10:13:04 1992
--- toplev.c.orig       Thu May 28 07:36:37 1992
***************
*** 1609,1615 ****
    if (profile_flag || profile_block_flag)
!     {
!       text_section ();
!       ASM_OUTPUT_SKIP(asm_out_file,UNITS_PER_WORD);
!       assemble_external_libcall(gen_rtx(SYMBOL_REF,Pmode,"mcount"));
!     }

--- 1609,1611 ----
    if (profile_flag || profile_block_flag)
!     assemble_zeros (UNITS_PER_WORD);


The problem is: I still cannot profile, since ld only has 65536 or so TOC
entries available, and my program (lots of C++) needs 101700 when profiled!
I suppose TOC information is doubled when profiled, so making my code a little
bit bigger will trigger the border even WITHOUT profiling! No FP constants,
only function definitions! So, PLEASE, devise a different scheme or tell IBM
to lift that border.

So long,

Sebastian Wangnick   Orthogon System GmbH
(basti@orthogo.uucp) Linzer Strasse 4
Tel +49 421 219136   D-2800 Bremen 33
Fax +49 421 213093   Germany
Technical Details
Message-ID: <9208271421.AA07068@orthogo.uucp>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!orthogo.UUCP!basti

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!orthogo.UUCP!basti
From: basti@orthogo.UUCP (Sebastian Wangnick)
Subject: Two bugs within gcc-2.2.2
Message-ID: <9208271421.AA07068@orthogo.uucp>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 27 Aug 1992 18:21:17 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 84