jakub [Tue, 8 Jan 2013 08:33:43 +0000 (08:33 +0000)]
PR tree-optimization/54120
* tree-vrp.c (range_fits_type_p): Don't allow
src_precision < precision from signed vr to unsigned_p
if vr->min or vr->max is negative.
(simplify_float_conversion_using_ranges): Test can_float_p
against CODE_FOR_nothing.
pault [Tue, 8 Jan 2013 06:13:52 +0000 (06:13 +0000)]
2013-01-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55618
* trans-expr.c (gfc_conv_procedure_call): Dereference scalar
character function arguments to elemental procedures in
scalarization loops.
2013-01-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55618
* gfortran.dg/elemental_scalar_args_2.f90: New test.
gjl [Mon, 7 Jan 2013 18:34:40 +0000 (18:34 +0000)]
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.
jason [Mon, 7 Jan 2013 18:00:18 +0000 (18:00 +0000)]
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.
jakub [Mon, 7 Jan 2013 17:46:30 +0000 (17:46 +0000)]
* 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.
rguenth [Mon, 7 Jan 2013 14:06:26 +0000 (14:06 +0000)]
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.
ebotcazou [Mon, 7 Jan 2013 10:39:45 +0000 (10:39 +0000)]
* 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.
dodji [Mon, 7 Jan 2013 08:06:46 +0000 (08:06 +0000)]
PR c++/55311 - Cannot specialize alias template with arg of type array of char
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.
dodji [Mon, 7 Jan 2013 08:03:33 +0000 (08:03 +0000)]
PR c++/52343 - error with alias template as template template argument
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.
pault [Sun, 6 Jan 2013 21:32:48 +0000 (21:32 +0000)]
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.
mikael [Sun, 6 Jan 2013 15:50:09 +0000 (15:50 +0000)]
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.
ebotcazou [Sun, 6 Jan 2013 12:28:58 +0000 (12:28 +0000)]
* 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.
mikael [Sat, 5 Jan 2013 13:20:08 +0000 (13:20 +0000)]
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.
burnus [Sat, 5 Jan 2013 09:11:19 +0000 (09:11 +0000)]
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.
burnus [Fri, 4 Jan 2013 21:51:34 +0000 (21:51 +0000)]
2013-01-04 Tobias Burnus <burnus@net-b.de>
* intrinsic.c (add_functions): New internal intrinsic
function GFC_PREFIX ("stride").
* gfortran.h (gfc_isym_id): Add GFC_ISYM_STRIDE.
* intrinsic.h (gfc_resolve_stride): New prototypes.
* iresolve.c (gfc_resolve_stride): New function.
* trans-intrinsic.c (conv_intrinsic_stride): New static
function.
(gfc_conv_intrinsic_function): Use it.
pault [Fri, 4 Jan 2013 20:50:15 +0000 (20:50 +0000)]
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.
jamborm [Fri, 4 Jan 2013 13:20:38 +0000 (13:20 +0000)]
2013-01-04 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/55755
* tree-sra.c (sra_modify_assign): Do not check that an access has no
children when trying to avoid producing a VIEW_CONVERT_EXPR.
charlet [Fri, 4 Jan 2013 09:28:49 +0000 (09:28 +0000)]
2013-01-04 Robert Dewar <dewar@adacore.com>
* types.ads, prj-conf.adb, par-tchk.adb: Minor reformatting.
2013-01-04 Robert Dewar <dewar@adacore.com>
* par-ch6.adb (P_Subprogram): Better handling of missing IS
after expression function.
* par-util.adb (No_Constraint): Improve handling to avoid bad warnings.
2013-01-04 Robert Dewar <dewar@adacore.com>
* exp_util.ads, exp_util.adb (Insert_Actions): In expression with
actions case, new actions are appended to the sequence rather than
prepended.
2013-01-04 Robert Dewar <dewar@adacore.com>
* gnat_ugn.texi: Document -gnatw.d/w.D (does no apply in VMS mode).
* usage.adb: Add lines for -gnatw.d/w.D switches.
* warnsw.adb: Minor fixes (some missing cases of setting
Warning_Doc_Switch). Reject -gnatw.d and -gnatw.D in VMS mode.
charlet [Fri, 4 Jan 2013 09:25:59 +0000 (09:25 +0000)]
2013-01-04 Robert Dewar <dewar@adacore.com>
* exp_util.adb (Remove_Side_Effects): Make sure scope suppress
is restored on exit.
2013-01-04 Robert Dewar <dewar@adacore.com>
* usage.adb: Document -gnateF (check overflow for predefined Float).
2013-01-04 Robert Dewar <dewar@adacore.com>
* sem_res.adb (Resolve_Type_Conversion): Remove incorrect
prevention of call to Apply_Type_Conversion_Checks, which resulted
in missing check flags in formal mode.
2013-01-04 Vincent Celier <celier@adacore.com>
* makeutl.ads (Db_Switch_Args): New table used by gprbuild.
* prj-conf.adb (Check_Builder_Switches): Check for switches
--config= (Get_Db_Switches): New procedure to get the --db
switches so that they are used when invoking gprconfig in
auto-configuration.
(Do_Autoconf): When invoking gprconfig, use the --db switches, if any.
charlet [Fri, 4 Jan 2013 09:24:06 +0000 (09:24 +0000)]
2013-01-04 Pascal Obry <obry@adacore.com>
* prj-nmsc.adb: Minor reformatting.
2013-01-04 Vincent Celier <celier@adacore.com>
* makeutl.ads (Root_Environment): New variable, moved rom
gprbuild (Load_Standard_Base): New Boolean variable, moved
from gprbuild.
* prj-conf.adb (Check_Builder_Switches): New procedure to check
for switch --RTS in package Builder. If a runtime specified
by --RTS is a relative path name, but not a base name, then
find the path on the Project Search Path.
(Do_Autoconf): Call Check_Builder_Switches.
(Locate_Runtime): New procedure, moved from gprbuild, to get the
absolute paths of runtimes when they are not specified as a base name.
* prj-conf.ads (Locate_Runtime): New procedure, moved from gprbuild.
charlet [Fri, 4 Jan 2013 09:21:55 +0000 (09:21 +0000)]
2013-01-04 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (Build_Private_Derived_Type): Set
Has_Private_Ancestor on type derived from an untagged private
type whose full view has discriminants
* sem_aggr.adb (Resolve_Record_Aggregate): Reject non-extension
aggregate for untagged record type with private ancestor.
* aspects.adb, aspects.ads: Add Aspect_Global to all relevant tables.
* par-prag.adb: Add pragma Global to the list of pragmas that
do not need special processing by the parser.
* sem_ch13.adb (Analyze_Aspect_Specifications): Convert aspect
Global into a pragma without any form of legality checks. The
work is done by Analyze_Pragma. The aspect and pragma are both
marked as needing delayed processing. Insert the corresponding
pragma of aspect Abstract_State in the visible declarations of the
related package.
(Check_Aspect_At_Freeze_Point): Aspect Global
does not need processing even though it is marked as delayed.
Alphabetize the list on aspect names.
* sem_prag.adb: Add a value for pragma Global in table Sig_Flags.
(Analyze_Pragma): Add ??? comment about the grammar of pragma
Abstract_State. Move the error location from the pragma to the
state to improve the quality of error placement. Add legality
checks for pragma Global.
* snames.ads-tmpl Add the following specially recognized names
2013-01-04 Eric Botcazou <ebotcazou@adacore.com>
* sem_ch3.adb: Fix minor typo.
2013-01-04 Ed Schonberg <schonberg@adacore.com>
* par-ch13.adb (Aspect_Specifications_Present): In Strict mode,
accept an aspect name followed by a comma, indicating a defaulted
boolean aspect.
* checks.adb (Generate_Index_Checks): Delay the generation of
the check for an indexed component where the prefix mentions
Loop_Entry until the attribute has been properly expanded.
* exp_ch5.adb (Expand_Loop_Entry_Attributes): Perform minor
decoration of the constant that captures the value of Loop_Entry's
prefix at the entry point into a loop. Generate index checks
for an attribute reference that has been transformed into an
indexed component.
2013-01-04 Thomas Quinot <quinot@adacore.com>
* exp_prag.adb, exp_util.adb, exp_util.ads, freeze.adb, exp_aggr.adb,
sem_ch13.adb (Exp_Aggr.Collect_Initialization_Statements): Nothing to
do if Obj is already frozen.
(Exp_Util.Find_Init_Call): Rename to...
(Exp_Util.Remove_Init_Call): New subprogram, renamed from
Find_Init_Call. Remove the initialization call from the enclosing
list if found, and if it is from an Initialization_Statements
attribute, reset it.
(Exp_Util.Append_Freeze_Action): Minor code reorganization.
(Exp_Util.Append_Freeze_Actions): Ensure a freeze node has been
allocated (as is already done in Append_Freeze_Action).
(Freeze.Freeze_Entity): For an object with captured
Initialization_Statements and non-delayed freezeing, unwrap the
initialization statements and insert and them directly in the
enclosing list.
(Sem_Ch13.Check_Address_Clause): For an object
with Initialization_Statements and an address clause, unwrap the
initialization statements when moving them to the freeze actions.
burnus [Fri, 4 Jan 2013 08:57:58 +0000 (08:57 +0000)]
2013-01-03 Tobias Burnus <burnus@net-b.de>
PR fortran/55854
PR fortran/55763
* class.c (gfc_class_null_initializer): Fix finding the vtab.
(gfc_find_intrinsic_vtab): Use BT_VOID for some components.
uros [Thu, 3 Jan 2013 17:16:08 +0000 (17:16 +0000)]
PR target/55712
* config/i386/i386-c.c (ix86_target_macros_internal): Depending on
selected code model, define __code_mode_small__, __code_model_medium__,
__code_model_large__, __code_model_32__ or __code_model_kernel__.
* config/i386/cpuid.h (__cpuid, __cpuid_count) [__i386__]: Prefix
xchg temporary register with %k. Declare temporary register as
early clobbered.
[__x86_64__]: For medium and large code models, preserve %rbx register.
jason [Thu, 3 Jan 2013 16:51:41 +0000 (16:51 +0000)]
PR c++/53650
* call.c (type_has_extended_temps): New.
* cp-tree.h: Declare it.
* decl.c (check_initializer): Use build_aggr_init for arrays
if it is false.
* init.c (build_vec_init): Avoid mixed signed/unsigned arithmetic.