Thread View: gnu.g++.bug
2 messages
2 total messages
Started by Doug Schmidt
Wed, 04 Oct 1989 06:11
fun fax to know and tell
Author: Doug Schmidt
Date: Wed, 04 Oct 1989 06:11
Date: Wed, 04 Oct 1989 06:11
29 lines
1534 bytes
1534 bytes
Here is a semi-interesting new C++ 2.0 feature to g++ 1.36.0-. It is
now possible to initialize global and static variables with
non-constant expressions (unlike C and cfront 1.2).
----------------------------------------
#include <stdio.h>
extern "C" int time (void *);
extern "C" int srand (int);
extern "C" int rand (void);
/* Initialize global variable via arbitrary function call... */
int random_number = int (srand (time (0)), rand ());
main ()
{
printf ("random number = %d\n", random_number);
}
----------------------------------------
I've not yet found a pressing need to incorporate this into any code,
but I'm sure there are applications for it...
Doug
--
schmidt@ics.uci.edu (ARPA) | Per me si va nella citta' dolente.
office: (714) 856-4043 | Per me si va nell'eterno dolore.
| Per me si va tra la perduta gente.
| Lasciate ogni speranza o voi ch'entrate.
Apparent g++ bug probably due to wrong bison version
Author: Lynn Slater
Date: Mon, 09 Oct 1989 14:57
Date: Mon, 09 Oct 1989 14:57
35 lines
1795 bytes
1795 bytes
When compiling libg++ 1.36 while installing g++1.36.0, I get
> File.cc: In method File::File (int, char *, enum io_mode):
> File.cc:258: Segmentation violation
I also get related errors on many other files.
GDB reveils that we are
> #0 0x3b58c in build_modify_expr (lhs=(tree) 0x160420, modifycode=NOP_EXPR, rhs=(tree) 0x18) (cplus-typeck.c line 4305)
Note that the rhs is a bad address.
Moving up shows that
> #1 0xcb0c in yyparse () (./cplus-parse.y line 902)
Which is
| expr_no_commas '=' expr_no_commas
{ $$ = build_modify_expr ($1, NOP_EXPR, $3); }
This seems to be a valid grammer. This and the gcc release notes make me
suspect that my bison release (uucp from osu-cis) may not be compatable. My
bison has a Changelog entry of
> Wed Aug 23 15:03:07 1989 Jay Fenlason (hack at gnu).
Can anybody please tell me if this is a correct version of bison to use.
Has anybody experienced this problem? Any suggestions?
-- Thanks in Advance. -- Lynn
--
===============================================================
Lynn Slater -- lrs@indetech.com or {sun, ames, pacbell}!indetech!lrs
42075 Lawrence Place, Fremont Ca 94538
Office (415) 438-2048; Home (415) 796-4149; Fax (415) 438-2034
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads