PR target/55897
* config/avr/avr.h (ADDR_SPACE_COUNT): New enum.
(avr_addrspace_t): Add .section_name field.
* config/avr/avr.c (progmem_section): Use ADDR_SPACE_COUNT as
array size.
(avr_addrspace): Same. Initialize .section_name. Remove last
NULL entry. Put __memx into .progmemx.data.
(progmem_section_prefix): Remove.
(avr_asm_init_sections): No need to initialize progmem_section.
(avr_asm_named_section): Use avr_addrspace[].section_name to get
section name prefix.
(avr_asm_select_section): Ditto. And use get_unnamed_section to
retrieve the progmem section.
* avr-c.c (avr_cpu_cpp_builtins): Use ADDR_SPACE_COUNT as loop
boundary to run over avr_addrspace[].
(avr_register_target_pragmas): Ditto.
From-SVN: r194991
PR c++/55753
* tree.c (build_aggr_init_expr): Do nothing in a template.
* pt.c (tsubst_copy_and_build) [CALL_EXPR]: Strip an ADDR_EXPR off
a FUNCTION_DECL before tsubsting.
From-SVN: r194986
* varasm.c (output_constant_def_contents): For asan_protect_global
protected strings, adjust DECL_ALIGN if needed, before testing for
anchored symbols.
(place_block_symbol): Adjust size for asan protected STRING_CSTs if
TREE_CONSTANT_POOL_ADDRESS_P. Increase alignment for asan protected
normal decls.
(output_object_block): For asan protected decls, emit asan padding
after their contents.
* asan.c (asan_protect_global): Don't check TREE_ASM_WRITTEN here.
(asan_finish_file): Test it here instead.
From-SVN: r194984
2013-01-07 Richard Biener <rguenther@suse.de>
PR tree-optimization/55888
PR tree-optimization/55862
* tree-ssa-pre.c (phi_translate_1): Revert previous change.
(valid_in_sets): Check if a NAME has a leader in AVAIL_OUT,
not if it is contained therein.
* gcc.dg/torture/pr55888.c: New testcase.
From-SVN: r194971
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: Adjust
comment about type extension with discriminants.
<E_Record_Subtype>: Remove useless test and reorder conditions.
(elaborate_entity) <E_Record_Subtype>: Likewise.
From-SVN: r194965
Consider this test case:
1 template <const char *const C, typename T>
2 struct A
3 {};
4
5 struct B {};
6
7 extern constexpr char HELLO_WORLD[] = "hello world";
8
9 A<HELLO_WORLD, B> g; // <-- This works fine
10
11 template <typename T>
12 using PartiallySpecialized = A<HELLO_WORLD, T>; // <-- This fails
13
At line 12 G++ fails to instantiate the alias template that has a
string variable initialized with a string literal, with the error
message:
test.cc:12:46: error: ‘"hello world"’ is not a valid template argument of type ‘const char*’ because ‘"hello world"’ is not a variable
using PartiallySpecialized = A<HELLO_WORLD, T>; // <-- This fails
^
Note that instantiating the template A at line 9 with the same
arguments as in the problematic case above works.
This happens in the context of lookup_template_class_1, when it handles
the alias template instantiation A<HELLO_WORLD, T> and thus passes the
VAR_DECL for HELLO_WORLD to convert_nontype_argument.
Note that from there decay_conversion replaces the the VAR_DECL with
its STRING_CST initializer[1]. Latter on, convert_nontype_argument
checks that the HELLO_WORLD constant it received as argument was
indeed a VAR_DECL:
else
{
tree decl;
decl = ((TREE_CODE (expr) == ADDR_EXPR)
? TREE_OPERAND (expr, 0) : expr);
if (TREE_CODE (decl) != VAR_DECL)
{
error ("%qE is not a valid template argument of type %qT "
"because %qE is not a variable",
expr, type, decl);
return NULL_TREE;
}
But the issue is, that VAR_DECL has been replaced by STRING_CST, so
the last 'if' above fails.
The fix is to teach decay_conversion to return the address of array,
rather than returning its initializer.
Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk.
gcc/cp/
PR c++/55311
* pt.c (decay_conversion): Do not return the initializer of an array.
gcc/testsuite/
PR c++/55311
* g++.dg/cpp0x/alias-decl-30.C: New test.
* g++.dg/init/array21.C: New test.
From-SVN: r194961
In the example accompanying this patch, check_instantiated_arg tries
to ensure that a non-type template argument should be a constant if it
has integral or enumeration type.
The problem is that an alias template which type-id is, e.g, an
integer, looks like an argument that has integral/enumeration type:
its TREE_TYPE is an integer type. So check_instantiated_arg
mistenkaly barks that this integral non-type argument is not a
constant.
Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk.
gcc/cp/
PR c++/52343
* pt.c (check_instantiated_arg): Allow type template arguments.
gcc/testsuite/
PR c++/52343
* g++.dg/cpp0x/alias-decl-29.C: New test.
From-SVN: r194960
2013-01-06 Paul Thomas <pault@gcc.gnu.org>
PR fortran/PR53876
PR fortran/PR54990
PR fortran/PR54992
* trans-array.c (build_array_ref): Check the TYPE_CANONICAL
to see if it is GFC_CLASS_TYPE_P.
* trans-expr.c (gfc_get_vptr_from_expr): The same.
(gfc_conv_class_to_class): If the types are not the same,
cast parmese->expr to the type of ctree.
* trans-types.c (gfc_get_derived_type): GFC_CLASS_TYPE_P of
CLASS components must be set.
2013-01-06 Paul Thomas <pault@gcc.gnu.org>
PR fortran/PR53876
PR fortran/PR54990
PR fortran/PR54992
* gfortran.dg/class_array_15.f03: New test.
From-SVN: r194953
PR fortran/42769
PR fortran/45836
PR fortran/45900
* module.c (read_module): Don't reuse local symtree if the associated
symbol isn't exactly the one wanted. Don't reuse local symtree if it is
ambiguous.
* resolve.c (resolve_call): Use symtree's name instead of symbol's to
lookup the symtree.
PR fortran/42769
PR fortran/45836
PR fortran/45900
* gfortran.dg/use_23.f90: New test.
* gfortran.dg/use_24.f90: New test.
* gfortran.dg/use_25.f90: New test.
* gfortran.dg/use_26.f90: New test.
* gfortran.dg/use_27.f90: New test.
From-SVN: r194949
* gcc-interface/decl.c (gnat_to_gnu_field): Emit a specialized
diagnostic for component size mismatch wrt volatile requirements.
Add a gcc_unreachable() at the end of the checks for size. Split
the check on volatile for positions into one check on atomic and
a subsequent one on volatile.
From-SVN: r194946
2013-01-05 Steven G. Kargl <kargl@gcc.gnu.org>
Mikael Morin <mikael@gcc.gnu.org>
PR fortran/55827
* class.c (gfc_fix_class_refs): Adapt ts initialization for the case
e->symtree == NULL.
* trans-expr.c (gfc_conv_function_expr): Init sym earlier. Use it.
2013-01-05 Steven G. Kargl <kargl@gcc.gnu.org>
Mikael Morin <mikael@gcc.gnu.org>
PR fortran/55827
* gfortran.dg/use_22.f90: New test.
Co-Authored-By: Mikael Morin <mikael@gcc.gnu.org>
From-SVN: r194928
2013-01-05 Tobias Burnus <burnus@net-b.de>
* class.c (finalize_component): Used passed offset expr.
(finalization_get_offset): New static function.
(finalizer_insert_packed_call, generate_finalization_wrapper):
Use it to handle noncontiguous arrays.
From-SVN: r194927
2013-01-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55172
* match.c (copy_ts_from_selector_to_associate): Remove call to
gfc_resolve_expr and replace it with explicit setting of the
array reference type.
* resolve.c (resolve_select_type): It is an error if the
selector is coindexed.
2013-01-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55172
* gfortran.dg/select_type_31.f03: New test.
From-SVN: r194916