public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Further observations regarding alloca on i586-pc-linux-gnu
@ 1998-08-20  9:09 Joerg Pommnitz
  1998-08-21  8:17 ` Noel Yap
  1998-08-21 16:30 ` Alexandre Oliva
  0 siblings, 2 replies; 25+ messages in thread
From: Joerg Pommnitz @ 1998-08-20  9:09 UTC (permalink / raw)
  To: egcs

While the following code dies with a segmentation violation
---
include <cstdlib>
#include <iostream>

class xx {
public:
        char *xy (char *c = alloca (18)) {
                strcpy (c, "Hello World!");
                return c;
        }
};

int
main ()
{
        xx x;
        cout << x.xy () << endl;
}  
---

this one works fine:

#include <cstdlib>
#include <iostream>

class xx {
public:
    char *xy (char *c = alloca (18)) {
	strcpy (c, "Hello World!");
	return c;
    }
};

int
main ()
{
    xx x;
    char *c = alloca (18);

    cout << x.xy (c) << endl;
}

Is this a bug? I think yes, but I'm not sure whether case #1
is supposed to work. Since alloca is a compiler builtin 
function this relates to egcs development and should either be
fixed or documented.

-- 
Regards
       Joerg
GMD-IPSI, Dolivostr. 15, Zimmer 120, D-64293 Darmstadt
+49-6151-869-786 (Phone), -818 (FAX)

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

end of thread, other threads:[~1998-08-27 13:38 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-20  9:09 Further observations regarding alloca on i586-pc-linux-gnu Joerg Pommnitz
1998-08-21  8:17 ` Noel Yap
1998-08-21 16:30 ` Alexandre Oliva
1998-08-22 11:00   ` Carlo Wood
1998-08-23  4:36     ` Richard Henderson
1998-08-23 12:13       ` Martin von Loewis
1998-08-23 18:49         ` Richard Henderson
1998-08-25 19:31           ` Martin von Loewis
1998-08-24  4:37         ` Jeffrey A Law
1998-08-25  7:28           ` Martin von Loewis
1998-08-24 10:48       ` Joerg Pommnitz
1998-08-25 12:45         ` Martin von Loewis
1998-08-25 19:31           ` Joerg Pommnitz
1998-08-25 19:31             ` Martin von Loewis
1998-08-25 23:05               ` signal 11 generating problem, was: " Joerg Pommnitz
1998-08-25 19:31                 ` Alexandre Oliva
1998-08-25 19:31                   ` Joerg Pommnitz
1998-08-25 23:05                   ` Martin von Loewis
1998-08-26  8:25                     ` Joe Buck
1998-08-26  5:20               ` Noel Yap
1998-08-26 11:57                 ` Joe Buck
1998-08-26  3:53             ` Andreas Schwab
1998-08-26 12:26             ` Oleg Zabluda
1998-08-27 13:38               ` Alexandre Oliva
1998-08-25 19:31         ` Richard Henderson

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