public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/27445]  New: create_tmp_var_raw (gimplify.c) inadventently asserts 'volatile' on temps
@ 2006-05-05 16:02 gary at intrepid dot com
  2006-05-05 16:05 ` [Bug c/27445] " pinskia at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 15+ messages in thread
From: gary at intrepid dot com @ 2006-05-05 16:02 UTC (permalink / raw)
  To: gcc-bugs

(see also: http://gcc.gnu.org/ml/gcc/2006-05/msg00158.html)

While following GCC's handling of 'volatile' and other type
qualifiers, I noticed that the gimplify pass created temporaries
with a type with 'volatile' asserted if the underlying type also
had 'volatile' asserted.

Temporaries are created by the create_tmp_var_raw() procedure
in gimplify.c, which reads as follows:

tree
create_tmp_var_raw (tree type, const char *prefix)
{
  tree tmp_var;
  tree new_type;

  /* Make the type of the variable writable.  */
  new_type = build_type_variant (type, 0, 0);
  TYPE_ATTRIBUTES (new_type) = TYPE_ATTRIBUTES (type);

  tmp_var = build_decl (VAR_DECL, prefix ? create_tmp_var_name (prefix) :
NULL,
                        type);
[...]

Note above that an unqualified type, new_type, is created but
then subsequently not used in the call to build_decl.  Because of
this omission, if 'type' originally had any qualifiers set
(such as volatile), they'll be propagated to the temporary, which
might have some unexpected effects on subsequent optimizations
and code generation.

The fix, I think, is to pass 'new_type'.


-- 
           Summary: create_tmp_var_raw (gimplify.c) inadventently asserts
                    'volatile' on temps
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gary at intrepid dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27445


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

end of thread, other threads:[~2006-05-06  1:42 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-05 16:02 [Bug c/27445] New: create_tmp_var_raw (gimplify.c) inadventently asserts 'volatile' on temps gary at intrepid dot com
2006-05-05 16:05 ` [Bug c/27445] " pinskia at gcc dot gnu dot org
2006-05-05 16:06 ` gary at intrepid dot com
2006-05-05 16:12 ` gary at intrepid dot com
2006-05-05 16:16 ` [Bug middle-end/27445] " pinskia at gcc dot gnu dot org
2006-05-05 16:37 ` gary at intrepid dot com
2006-05-05 16:39   ` Andrew Pinski
2006-05-05 16:39 ` pinskia at physics dot uc dot edu
2006-05-05 16:58 ` gary at intrepid dot com
2006-05-05 17:10 ` pinskia at gcc dot gnu dot org
2006-05-05 17:55 ` gary at intrepid dot com
2006-05-05 18:06   ` Daniel Berlin
2006-05-05 18:07 ` dberlin at dberlin dot org
2006-05-06  1:17 ` rth at gcc dot gnu dot org
2006-05-06  1:42 ` gary at intrepid dot com

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