[Bug c/27445] New: create_tmp_var_raw (gimplify.c) inadventently asserts 'volatile' on temps
gary at intrepid dot com
gcc-bugzilla@gcc.gnu.org
Fri May 5 16:02:00 GMT 2006
(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
More information about the Gcc-bugs
mailing list