Article View: gnu.gcc.help
Article #52819gcc-2.1
From: Wolfgang Kechel - Patzschke + Ra...
Date: Fri, 08 May 1992 13:42
Date: Fri, 08 May 1992 13:42
116 lines
4997 bytes
4997 bytes
Hi,
here some bugs & fixes for gcc-2.1 running on Sun4/SunOS4.1.1/4.1.2 and hp9700
under hpux.
1. Many things for fixing a lot of bugs from gcc-2.0. I'm very thankful for
the implementation of templates in g++ for classes and functions.
2. collect2 causes problems on both systems, because the function 'savestring'
has a serious bug, that causes a core-dump when giving -f<xxxx> or
-m<xxxx>-options to gcc/g++. the strcpy-statement may not be used in this
context. You'll find the fix of this function in the output below.
3. When passing -f<xxx> to g++ and you have some constructors for static
objects, collect2 will use gcc as the final linker. It happens that you might
have passed options to g++ (-felide-constructors -fsave-memoized
-fno-handle-exceptions) which are not understood by gcc but only by g++.
I'v programmed a work-around in collect2 via a table that contains a table of
options that might not be passed to the final gcc-run. A better solution might
be to set the environment-variable COLLECT_GCC?? to g++ instead of gcc, but it
seems to me that this would cause a recusive invocation of collect2 (is this
really the case? - I've not tried it)
4. One more problem occured when compiling collect2 on a hp9700 under hpux. It
seems that the smell of varargs is different in gcc and the standard include
stdio.h (where the prototype of vfprintf is defined). I've implemented some
special treatment of hpux in collect2
5. There is some change in g++-2.1 that causes some problems when returning
references from member-functions in c++. I can not explain the program in
detail, but here is a short overview.
I use a collection-calls from libg++ (ClassA-ClassB-AVLMap, lets call it M1).
An instance of this class is member of another class which is also a Map, so I
have ClassC-M1-AVLMAP, lets call it M2). now I'd like to get a reference to an
element in M1 via the function operator[]. I do this via
(M2[ClassCinstance])[ClassAinstance]
which yields a pointer to the element I'd like to return as pointer, looking
like:
return *((M2[ClassCinstance])[ClassAinstance])
This code compiled correctly with gc++-2.0, g++-2.1 tells me something like:
too few arguments to constructor ClassB.
Hopefully I can send you more details when I have got the time to evaluate the
problem more closely.
6. One more remaining problem on Sun is the treatment of -Bstatic -Bdynamic by
gcc. It is impossible at the moment to select for each library wether to link
statically or dynamically - this is caused by the treatment of linker-options
in gcc (they are all placed before the libraries, so theydo not have effects
on the link-style for the library.
And now the diffs of collect2 (to normal gcc-2.1 collect):
diff collect2.c(my one) collect2-21.c(original) yields
30,33d29
< #ifdef hpux
< #define vfprintf __vfprintf
< #define NO_SYS_SIGLIST
< #endif
191d186
< #ifndef hpux
193d187
< #endif
305,308d298
< #ifdef hpux
< #undef vfprintf
< #endif
<
411,418c401
<
< /* start wke changes */
< char *cp = output;
<
< for ( *cp = '\0'; *input && size > 0; --size )
< *cp++ = *input++;
< *cp = '\0';
< /* strcpy (output, input); */
---
> strcpy (output, input);
738,759c721,724
< /* wke changes: don't pass -f<xxxx> to gcc with <xxx> from table */
< char *donotpass[] = {
< "-felide-constructors",
< "-fsave-memoized",
< "-fno-handle-exceptions",
< 0
< };
< char *q = p;
< while (*q && *q != ' ') q++;
< if (*p == '-' && (p[1] == 'm' || p[1] == 'f')) {
< int ii;
< char *cp = savestring( p, q - p );
< for ( ii = 0; donotpass[ii] != 0; ++ii )
< if ( strcmp( cp, donotpass[ii] ) == 0 )
< break;
< if ( donotpass[ii] == 0 )
< *c_ptr++ = cp;
< else
< free( cp );
< /* *c_ptr++ = savestring (p, q - p);*/
< }
<
---
> char *q = p;
> while (*q && *q != ' ') q++;
> if (*p == '-' && (p[1] == 'm' || p[1] == 'f'))
> *c_ptr++ = savestring (p, q - p);
Hopefully, this helps you to make gcc more portable and correct
bye
+-Wolfgang Kechel_------------------------------------------------+
| Email: wolfgang@apollon.uucp or wolfgang%apollon@germany.eu.net |
| Phone: +49-611-1731-26 FAX: +49-0611-173131 |
+-----------------------------------------------------------------+
Technical Details
Message-ID:
<9205080942.AA10696@GAIA>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!apollon.UUCP!wolfgangShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,4e94ecfe68ff287e,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1992-05-08 06:42:31 PST Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!apollon.UUCP!wolfgang From: wolfgang@apollon.UUCP (Wolfgang Kechel - Patzschke + Rasp GmbH) Subject: gcc-2.1 Message-ID: <9205080942.AA10696@GAIA> Sender: daemon@cis.ohio-state.edu Organization: GNUs Not Usenet Distribution: gnu Date: Fri, 8 May 1992 13:42:31 GMT Lines: 116