public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* grokdeclarator drops type qualifiers when -aux-info isn't asserted?
@ 2009-05-20  9:45 Gary Funck
  2009-05-20 14:22 ` Joseph S. Myers
  0 siblings, 1 reply; 3+ messages in thread
From: Gary Funck @ 2009-05-20  9:45 UTC (permalink / raw)
  To: GCC List

Recently, I was debugging an issue in the GCC/UPC front-end
that related to some problems compiling specific UPC type
declarations.  The front-end was, in certain cases, dropping
UPC's "shared" qualifier.

The relevant code is in grokdeclarator:

  if (!flag_gen_aux_info && (TYPE_QUALS (element_type)))
      type = TYPE_MAIN_VARIANT (type);

Above, if the -aux-info switch isn't asserted
then the type is set to its main variant.

The -aux-info switch does the following:

`-aux-info FILENAME'
     Output to the given filename prototyped declarations for all
     functions declared and/or defined in a translation unit, including
     those in header files.  This option is silently ignored in any
     language other than C. [...]

Given that this switch enables the generation of a report,
it is surprising that this switch would cause the front-end
to work differently depending upon whether -aux-info is asserted or not.

That aside, I wonder if it is an error to drop the qualifiers
as shown above?  In the case of UPC, for example, dropping qualifiers
definitely leads to problems; it may be the case that UPC's
logic has to be reworked a bit if, in fact, the TYPE_MAIN_VARIANT()
call above is needed.

thanks,
- Gary

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

* Re: grokdeclarator drops type qualifiers when -aux-info isn't  asserted?
  2009-05-20  9:45 grokdeclarator drops type qualifiers when -aux-info isn't asserted? Gary Funck
@ 2009-05-20 14:22 ` Joseph S. Myers
  2009-05-20 21:02   ` Gary Funck
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph S. Myers @ 2009-05-20 14:22 UTC (permalink / raw)
  To: Gary Funck; +Cc: GCC List

On Tue, 19 May 2009, Gary Funck wrote:

> That aside, I wonder if it is an error to drop the qualifiers
> as shown above?  In the case of UPC, for example, dropping qualifiers

Please read the code (and comment) immediately above that you quoted, 
which saves the qualifiers combined with those specified in the 
declaration, and the subsequent code applying them in the process of 
building up the type.  The bug would probably be that it doesn't also drop 
them if flag_gen_aux_info.  See the named address space patches for 
examples of adding extra type qualifiers.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: grokdeclarator drops type qualifiers when -aux-info isn't  asserted?
  2009-05-20 14:22 ` Joseph S. Myers
@ 2009-05-20 21:02   ` Gary Funck
  0 siblings, 0 replies; 3+ messages in thread
From: Gary Funck @ 2009-05-20 21:02 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: GCC List

On 05/20/09 09:45:11, Joseph S. Myers wrote:
> On Tue, 19 May 2009, Gary Funck wrote:
> 
> > That aside, I wonder if it is an error to drop the qualifiers
> > as shown above?  In the case of UPC, for example, dropping qualifiers
> 
> Please read the code (and comment) immediately above that you quoted, 
> which saves the qualifiers combined with those specified in the 
> declaration, and the subsequent code applying them in the process of 
> building up the type.  
> [...] See the named address space patches for 
> examples of adding extra type qualifiers.

Thanks.  We've generally gotten that part right by adding a few
qualifier bits.  We can't however encode UPC's "layout qualifier"
into the qualifier bits and we have to maintain it separately.
I do see now that the layout qualifier on an element type should
be handled earlier along with the rest of the qualifiers in the
section that you're referencing.

> The bug would probably be that it doesn't also drop 
> them if flag_gen_aux_info.

Agreed.  Though presumably the flag_gen_aux_info logic
will have to be adjusted as well.

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

end of thread, other threads:[~2009-05-20 18:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-20  9:45 grokdeclarator drops type qualifiers when -aux-info isn't asserted? Gary Funck
2009-05-20 14:22 ` Joseph S. Myers
2009-05-20 21:02   ` Gary Funck

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