public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Bootstrapping hppa64? CPP problem
@ 2002-07-10 23:15 Steve Ellcey
  2002-07-11  5:32 ` Zack Weinberg
  2002-07-11  7:42 ` Neil Booth
  0 siblings, 2 replies; 12+ messages in thread
From: Steve Ellcey @ 2002-07-10 23:15 UTC (permalink / raw)
  To: gcc

I am curious if anyone is currently bootstrapping the hppa64 GCC
compiler from the latest sources?  I am running into a very curious cpp
problem.  With the attached example, using the cc1 that I just built I
get two definitions of sigpause showing up because _SVID2 seems to be
considered defined and undefined at the same time.  It doesn't happen on
the other platforms I have tried but it happens consistenly for me on
PA64.

Steve Ellcey
sje@cup.hp.com

[hpsje - sje_pa64] $ cat x.c
#define _SVID2

#if !defined(_SVID2)
     extern long sigpause(long);
#endif

#if defined(_SVID2)
           extern int sigpause(int);
#endif

--------------------------------

[hpsje - sje_pa64] $ obj_pa64_gcc/gcc/cc1 -E -quiet x.c
# 1 "x.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "x.c"



     extern long sigpause(long);



           extern int sigpause(int);

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: Bootstrapping hppa64? CPP problem
@ 2002-07-10 23:56 John David Anglin
  0 siblings, 0 replies; 12+ messages in thread
From: John David Anglin @ 2002-07-10 23:56 UTC (permalink / raw)
  To: gcc; +Cc: sje

> I am curious if anyone is currently bootstrapping the hppa64 GCC
> compiler from the latest sources?  I am running into a very curious cpp
> problem.  With the attached example, using the cc1 that I just built I
> get two definitions of sigpause showing up because _SVID2 seems to be
> considered defined and undefined at the same time.  It doesn't happen on
> the other platforms I have tried but it happens consistenly for me on
> PA64.

I filed a PR for the exact same problem on vax-dec-ultrix4.3.  However,
I couldn't duplicate it with a cross compiler.  It appears '!' isn't
being processed correctly.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: Bootstrapping hppa64? CPP problem
@ 2002-07-11  3:22 Steve Ellcey
  2002-07-11  3:51 ` Jeff Law
  2002-07-11  6:44 ` Neil Booth
  0 siblings, 2 replies; 12+ messages in thread
From: Steve Ellcey @ 2002-07-11  3:22 UTC (permalink / raw)
  To: dave; +Cc: gcc

> I filed a PR for the exact same problem on vax-dec-ultrix4.3.  However,
> I couldn't duplicate it with a cross compiler.  It appears '!' isn't
> being processed correctly.

I am trying to dig into this some more and I don't think it is in the
'!'  code.  I am currently looking at eval_token, being called from
_cpp_parse_expr, being called from do_if and am looking at the symbol
_SVID2 in eval_token.

On a system where things work I get into 'case CPP_NAME' inside
eval_token and find that the if statement:

	if (token->val.node == pfile->spec_nodes.n_defined)

is true and we call parse_defined and return the correct value.

On hppa64 I get to the same location in the code and find that this if
statement is false and the two pointers are not the same.  I was
wondering if it was a 64 bit issue with the cpp hash table or something?
Is vax-dec-ultrix4.3 64 bits?  The two values I see being compared
aren't even remotely close on hppa64 and look to be in different sections.

(gdb) p token->val.node
$1 = (struct cpp_hashnode *) 0x5f696e5f6e756c6c
(gdb) p pfile->spec_nodes.n_defined
$2 = (struct cpp_hashnode *) 0x80000001000c6030

pfile->spec_nodes.n_defined looks like a basic 64 bit data pointer on
hppa64 but token->val.node looks weird like it might be in text or
read-only memory somewhere.

Steve Ellcey
sje@cup.hp.com

^ permalink raw reply	[flat|nested] 12+ messages in thread
[parent not found: <no.id>]
* Re: Bootstrapping hppa64? CPP problem
@ 2002-07-11 13:25 Steve Ellcey
  2002-07-11 13:31 ` John David Anglin
  0 siblings, 1 reply; 12+ messages in thread
From: Steve Ellcey @ 2002-07-11 13:25 UTC (permalink / raw)
  To: neil, dave, zack, law; +Cc: gcc

Hm, curiouser and curiouser.

Walking through with the debugger, I stop in _cpp_parse_expr at line 739
just before calling eval_token.  I print 'token->val.node' and I see
0x80000001000c6030.  I then step into eval_token and token->val.node is
0x5f696e5f6e756c6c.

In fact if I print out token before the call to eval_token, I see:

(gdb) p *token
$1 = {line = 19, col = 6, type = CPP_NAME, flags = 0 '\000', val = {
    node = 0x80000001000c6030, source = 0x80000001000c6030, str = {
      len = 2147483649, text = 0x0}, arg_no = 2147483649, c = 128 '\200'}}

After the call I see:

(gdb) p *token
$2 = {line = 1734702175, col = 24948, type = 116, flags = 114 'r', val = {
    node = 0x5f696e5f6e756c6c, source = 0x5f696e5f6e756c6c, str = {
      len = 1600745055,
      text = 0x69666965645f6272 <Error reading address 0x69666965645f6272: Bad a
ddress>}, arg_no = 1600745055, c = 95 '_'}}

Which looks like complete junk.  So the argument token is not being
passed correctly to eval_token.  The first argument (pfile) looks OK
after getting into eval_token, it has the address 0x800000010007b450
before and after the call but token gets changed from 0x800000010007b8d8
before the call to 0x40000000000633e0 inside eval_token which is wrong.

I just rebuilt gcc with the HP compiler instead of using a 3.0.2 based
GCC which I had been using and that seems to be behaving correctly so I
think the basic problem here is a bug in my hppa64 GCC (3.0.2) that I am
using to build the latest GCC with.  I am going to rebuild the latest
sources using HP C and then use that to bootstrap GCC and see if that
works better.

Steve Ellcey
sje@cup.hp.com

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

end of thread, other threads:[~2002-07-11 16:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-10 23:15 Bootstrapping hppa64? CPP problem Steve Ellcey
2002-07-11  5:32 ` Zack Weinberg
2002-07-11  7:42 ` Neil Booth
2002-07-11  8:33   ` Neil Booth
2002-07-10 23:56 John David Anglin
2002-07-11  3:22 Steve Ellcey
2002-07-11  3:51 ` Jeff Law
2002-07-11  6:44 ` Neil Booth
2002-07-11 13:16   ` John David Anglin
     [not found] <no.id>
2002-07-11  6:34 ` John David Anglin
2002-07-11 13:25 Steve Ellcey
2002-07-11 13:31 ` John David Anglin

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