public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ front-end question
@ 2003-03-10 16:39 Eric Botcazou
  2003-03-11  8:27 ` Mark Mitchell
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Botcazou @ 2003-03-10 16:39 UTC (permalink / raw)
  To: gcc

Hi,

This is related to PR opt/8396, a high-priority PR on Sparc.

Is it normal for the C++ front-end to pass the following tree to the RTL 
expander in the following situation, when compiled with -O (i.e inlining 
on)?

struct Foo
{
  static void bar(const short int xs, const int short xe)
  {
    if (xe && (xs < xe))
      ;
  }
};

void f()
{   
  short int xe;

  Foo::bar(0, xe);
}


(gdb) p debug_tree(0x40162c60)
 <lt_expr 0x40162c60
    type <boolean_type 0x40186b54 bool unsigned QI
        size <integer_cst 0x4015ba20 constant 8>
        unit size <integer_cst 0x4015b8a0 constant 1>
        align 8 symtab 0 alias set -1 precision 1 min <integer_cst 0x40162580 
0> max <integer_cst 0x401625c0 1>>
    readonly
    arg 0 <integer_cst 0x40162ba0 type <integer_type 0x40156488 int> constant 
0>
    arg 1 <var_decl 0x401a489c xe
        type <integer_type 0x401a1244 short int readonly HI
            size <integer_cst 0x4015b160 constant 16>
            unit size <integer_cst 0x4015b240 constant 2>
            align 16 symtab 0 alias set -1 precision 16 min <integer_cst 
0x4015b200 -32768> max <integer_cst 0x4015b220 32767>>
        readonly used HI file ../pr8396.cpp line 6 size <integer_cst 
0x4015b160 16> unit size <integer_cst 0x4015b240 2>
        align 16 context <function_decl 0x401a45e4 f> abstract_origin 
<parm_decl 0x401a132c xe> initial <nop_expr 0x401a60b4>
        (reg/v:HI 108 [ xe ])>>


Note the <integer_type 0x40156488 int> for 0 and <integer_type 0x401a1244 
short int> for xe.

In the same situation (i.e inlining on), the C front-end is more careful (it 
promotes 0 and xe to 'int', but using 'short int' for 0 would be fine too).

-- 
Eric Botcazou

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

* Re: C++ front-end question
  2003-03-10 16:39 C++ front-end question Eric Botcazou
@ 2003-03-11  8:27 ` Mark Mitchell
  2003-03-12 11:25   ` Eric Botcazou
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Mitchell @ 2003-03-11  8:27 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc

On Mon, 2003-03-10 at 08:25, Eric Botcazou wrote:
> Hi,
> 
> This is related to PR opt/8396, a high-priority PR on Sparc.
> 
> Is it normal for the C++ front-end to pass the following tree to the RTL 
> expander in the following situation, when compiled with -O (i.e inlining 
> on)?

No, that sounds like a bug to me.

Thanks,

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

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

* Re: C++ front-end question
  2003-03-11  8:27 ` Mark Mitchell
@ 2003-03-12 11:25   ` Eric Botcazou
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Botcazou @ 2003-03-12 11:25 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: gcc

> No, that sounds like a bug to me.

Thanks for the quick answer. And I got caught by the different inlining 
strategies of the C and C++ front-ends when I was playing with gdb, so it 
turns out that the C front-end passes roughly the same tree and cc1 crashes 
too.

Looks like a bad interaction between the front-ends and the tree inliner, 
I'll submit a tentative fix shortly.

-- 
Eric Botcazou

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

end of thread, other threads:[~2003-03-12  9:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-10 16:39 C++ front-end question Eric Botcazou
2003-03-11  8:27 ` Mark Mitchell
2003-03-12 11:25   ` Eric Botcazou

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