public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Re: g++ gives gratuitous "will use a temporary" warnings in CVS 19990611
       [not found] <19990710042745.A29341@drow.res.cmu.edu>
@ 1999-07-12 22:29 ` Alexandre Oliva
  1999-07-13  7:19   ` Daniel Jacobowitz
  1999-07-31 23:33 ` Alexandre Oliva
  1 sibling, 1 reply; 3+ messages in thread
From: Alexandre Oliva @ 1999-07-12 22:29 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: egcs-bugs

On Jul 10, 1999, Daniel Jacobowitz <drow@false.org> wrote:

> The attached test program shows a warning regression in g++:

> test.cc:5: initializing non-const `const char *&' with `char *' will use a temporary
> test.cc:1: in passing argument 1 of `f(const char *&)'

It's not a regression, it really uses a temporary, even though it
shouldn't.  The code is ill-formed, see
http://reality.sgi.com/austern/std-c++/faq.html#C1

> void f(const char *&c);
> void g() { char *d; f(d); }

You should write:

void f(const char *const &c);

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{dcc.unicamp.br,guarana.{org,com}} aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them


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

* Re: g++ gives gratuitous "will use a temporary" warnings in CVS 19990611
  1999-07-12 22:29 ` g++ gives gratuitous "will use a temporary" warnings in CVS 19990611 Alexandre Oliva
@ 1999-07-13  7:19   ` Daniel Jacobowitz
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 1999-07-13  7:19 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: egcs-bugs

On Tue, Jul 13, 1999 at 02:28:57AM -0300, Alexandre Oliva wrote:
> On Jul 10, 1999, Daniel Jacobowitz <drow@false.org> wrote:
> 
> > The attached test program shows a warning regression in g++:
> 
> > test.cc:5: initializing non-const `const char *&' with `char *' will use a temporary
> > test.cc:1: in passing argument 1 of `f(const char *&)'
> 
> It's not a regression, it really uses a temporary, even though it
> shouldn't.  The code is ill-formed, see
> http://reality.sgi.com/austern/std-c++/faq.html#C1
> 
> > void f(const char *&c);
> > void g() { char *d; f(d); }
> 
> You should write:
> 
> void f(const char *const &c);

But that isn't what's needed here.  c actually gets modified inside the
function f().  The value it points to does not.

Does that same FAQ entry truly apply to "T *&" ?



Dan

/--------------------------------\  /--------------------------------\
|       Daniel Jacobowitz        |__|        SCS Class of 2002       |
|   Debian GNU/Linux Developer    __    Carnegie Mellon University   |
|         dan@debian.org         |  |       dmj+@andrew.cmu.edu      |
\--------------------------------/  \--------------------------------/
>From jaffe@cpthree.unl.edu Tue Jul 13 07:43:00 1999
From: jaffe@cpthree.unl.edu
To: egcs-bugs@egcs.cygnus.com, jaffe@cpthree.unl.edu
Subject: bug report
Date: Tue, 13 Jul 1999 07:43:00 -0000
Message-id: <199907131437.JAA04767@cpthree.unl.edu>
X-SW-Source: 1999-07/msg00490.html
Content-length: 683

// The following code produces a segmentation fault when compiled using g++
// (egcs-2.91.66) on an Alpha DP21264.  I could not reproduce the bug on
// an Intel machine or a Sparc.  The fault occurs on the second pass
// of the for loop, on the line "Integer a;".  No options were given to the
// compiler.

// David Jaffe
// Dept. of Math. and Stat.
// Univ. of Nebraska - Lincoln
// U.S.A.
// e-mail: jaffe@cpthree.unl.edu

class Integer {
   public:
     int a;
     Integer( ) { }
     ~Integer( ) { }
};

bool woof(int n) { return true; }

main( )
{    for ( int i = 0; i < 2; i++ )
     {    bool x = false;
          {    Integer a;    }
          x = woof(1) || x;    }    }
>From rth@cygnus.com Tue Jul 13 09:25:00 1999
From: Richard Henderson <rth@cygnus.com>
To: Alexandre Oliva <oliva@dcc.unicamp.br>
Cc: law@cygnus.com, egcs-bugs@egcs.cygnus.com, egcs-patches@egcs.cygnus.com
Subject: Re: shared libstdc++ is broken on alphaev56-dec-osf4.0d
Date: Tue, 13 Jul 1999 09:25:00 -0000
Message-id: <19990713092516.B8414@cygnus.com>
References: <635.931650096@upchuck.cygnus.com> <oru2r9i4ws.fsf@cupuacu.lsd.dcc.unicamp.br>
X-SW-Source: 1999-07/msg00491.html
Content-length: 365

On Tue, Jul 13, 1999 at 12:50:59AM -0300, Alexandre Oliva wrote:
> But a *very serious* set of known problems.  The way it is now,
> libstdc++ on OSF4/alpha is useless for any non-trivial C++ program.
> :-(

What you mean is that a _shared_ libstdc++ is useless.
Our position at this point must be that you must use a
static libstdc++ on osf for this release.


r~
>From Eric.Freudenthal@nyu.edu Tue Jul 13 10:02:00 1999
From: Eric.Freudenthal@nyu.edu
To: egcs-bugs@egcs.cygnus.com
Cc: ristroph@alphatech.com, record@ext.rlab.cs.nyu.edu
Subject: better egcs snapshot than 2.95?
Date: Tue, 13 Jul 1999 10:02:00 -0000
Message-id: <9907131702.AA32195@eric.ultra.nyu.edu>
X-SW-Source: 1999-07/msg00492.html
Content-length: 333

As I reported previously, we've had some trouble building our project
under egcs (the compiler fails with an internal error).  A full bug
report including cpp output can be found at

 http://ext.rlab.cs.nyu.edu/~freudent/xfer/egcs-bug-2/bug-report.html

Can you recommend another stable snapshot that I might try?

Many thanks,
Eric
>From oliva@dcc.unicamp.br Tue Jul 13 10:14:00 1999
From: Alexandre Oliva <oliva@dcc.unicamp.br>
To: Richard Henderson <rth@cygnus.com>
Cc: law@cygnus.com, egcs-bugs@egcs.cygnus.com, egcs-patches@egcs.cygnus.com
Subject: Re: shared libstdc++ is broken on alphaev56-dec-osf4.0d
Date: Tue, 13 Jul 1999 10:14:00 -0000
Message-id: <ork8s4bhhp.fsf@cupuacu.lsd.dcc.unicamp.br>
References: <635.931650096@upchuck.cygnus.com> <oru2r9i4ws.fsf@cupuacu.lsd.dcc.unicamp.br> <19990713092516.B8414@cygnus.com>
X-SW-Source: 1999-07/msg00493.html
Content-length: 1933

On Jul 13, 1999, Richard Henderson <rth@cygnus.com> wrote:

> On Tue, Jul 13, 1999 at 12:50:59AM -0300, Alexandre Oliva wrote:
>> But a *very serious* set of known problems.  The way it is now,
>> libstdc++ on OSF4/alpha is useless for any non-trivial C++ program.
>> :-(

> What you mean is that a _shared_ libstdc++ is useless.

Yup, I had intended to write libstdc++.so

> Our position at this point must be that you must use a static
> libstdc++ on osf for this release.

Well, this means you're just pushing the problem onto the user.  OSF
is smart enough to copy symbols from static libraries into shared
libraries.  However, if more than one shared library gets the same
symbols, you won't be able to link them together.  This means you're
condemning OSF users not only to bloat their executables because of
libstdc++, but also because of almost *any other C++ library*.  I.e.,
if they link the library with g++ -shared, the library will be linked
with libstdc++.  If libstdc++ is static, some symbols will be copied
from it.  Now create another library with the same procedure, and you
won't be able to link them into the same program.

Anyway, if your position is to recommend static libstdc++, I see no
reason to reject my patch, given that it fixes a very serious problem
in a configuration that's broken and not recommended anyway, it's
platform specific and has minimal impact.  The other option is to
change libstdc++/configure.in to completely disable shared library
support on OSF, or at least emit large blinking warnings that it's
broken, which doesn't seem reasonable to me if there's such a trivial
patch that fixes the problem.

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{dcc.unicamp.br,guarana.{org,com}} aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them


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

* Re: g++ gives gratuitous "will use a temporary" warnings in CVS 19990611
       [not found] <19990710042745.A29341@drow.res.cmu.edu>
  1999-07-12 22:29 ` g++ gives gratuitous "will use a temporary" warnings in CVS 19990611 Alexandre Oliva
@ 1999-07-31 23:33 ` Alexandre Oliva
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 1999-07-31 23:33 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: egcs-bugs

On Jul 10, 1999, Daniel Jacobowitz <drow@false.org> wrote:

> The attached test program shows a warning regression in g++:

Err...  Which attached test program?

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{guarana.com,{gnu,kaffe,samba}.org,{egcs,sourceware}.cygnus.com}
*** E-mail about software projects will be forwarded to mailing lists


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

end of thread, other threads:[~1999-07-31 23:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <19990710042745.A29341@drow.res.cmu.edu>
1999-07-12 22:29 ` g++ gives gratuitous "will use a temporary" warnings in CVS 19990611 Alexandre Oliva
1999-07-13  7:19   ` Daniel Jacobowitz
1999-07-31 23:33 ` Alexandre Oliva

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