2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31257
* intrinsic.c (add_functions): Add ref. to gfc_resolve_achar.
* intrinsic.h : Add prototype for gfc_resolve_achar.
* iresolve.c (gfc_resolve_achar): New function.
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31257
* gfortran.dg/achar_4.f90: New test.
From-SVN: r123646
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30880
* resolve.c (resolve_fl_variable): Set flag to 2 for automatic
arrays. Make condition for automatic array error explicit.
If a dummy, no error on an INTENT(OUT) derived type.
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30880
* gfortran.dg/used_dummy_types_8.f90: New test.
From-SVN: r123645
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30872
* expr.c (find_array_element): Correct arithmetic for rank > 1.
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30872
* gfortran.dg/parameter_array_element_1.f90: New test.
From-SVN: r123644
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31222
* check.c (numeric_check): If an expresson has not got a type,
see if it is a symbol for which a default type applies.
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31222
* gfortran.dg/default_numeric_type_1.f90: New test.
From-SVN: r123643
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31214
* trans-decl.c (gfc_get_symbol_decl): Allow unreferenced use
associated symbols.
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31424
* gfortran.dg/unreferenced_use_assoc_1.f90: New test.
From-SVN: r123642
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31293
* symbol.c (gfc_check_function_type): New function.
* gfortran.h : Add prototype for previous.
* parse.c (parse_progunit): Call it after parsing specification
statements.
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31293
* gfortran.dg/interface_12.f90: New test.
From-SVN: r123641
2007-04-06 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31117
* config/locale/gnu/c_locale.cc (__convert_to_v): Do not use errno,
just check that the value is finite.
* config/locale/generic/c_locale.cc (__convert_to_v): Likewise.
From-SVN: r123635
* tree-ssa-loop-niter.c (idx_infer_loop_bounds): Add and use
argument "reliable".
(infer_loop_bounds_from_ref, infer_loop_bounds_from_array):
Add argument "reliable". Propagate it through calls.
(infer_loop_bounds_from_undefined): Derive number of iterations
estimates from references in blocks that do not dominate loop latch.
(gcov_type_to_double_int): New function.
(estimate_numbers_of_iterations_loop): Use gcov_type_to_double_int
and expected_loop_iterations_unbounded.
* cfgloopanal.c (expected_loop_iterations_unbounded): New function.
(expected_loop_iterations): Use expected_loop_iterations_unbounded.
* tree-data-ref.c (estimated_loop_iterations): Export.
(get_references_in_stmt): Fix -- do not return addresses of local
objects.
* cfgloop.h (expected_loop_iterations_unbounded,
estimated_loop_iterations): Declare.
From-SVN: r123630
* config/i386/i386.md (extend<mode>xf2): Rename from extendsfxf2
and extenddfxf2. Macroize expander using X87MODEF12 mode macro.
(*truncdfsf_mixed, *truncdfsf_i387, *truncdfsf2_i387_1):
Use output_387_reg_move().
(*truncxf<mode>2): Rename from *truncxfsf2 and truncxfdf2. Macroize
expander using X87MODEF12 mode macro.
(*truncxfsf2_mixed): Combine alternatives, ignore "r" alternative when
choosing register preferences. Use output_387_reg_move().
(*truncxfdf2_mixed): Combine alternatives, use "r" alternative
instead of "x". Use output_387_reg_move().
(*truncxf<mode>2_i387_noop): Rename from *truncxfsf2_i387_noop and
*truncxfdf2_i387_noop. Macroize insn using X87MODEF12 mode macro.
(*truncxf<mode>2_i387): Rename from *truncxfsf2_i387 and
*truncxfdf2_i387. Macroize insn using X87MODEF12 mode macro.
Use output_387_reg_move().
(*truncxf?f_mixed splitter): Macroize splitter using X87MODEF12
mode macro.
(*truncxf?f_i387 splitter): Ditto.
From-SVN: r123626
* configure.ac: Tidy target case.
(HAVE_LONG_DOUBLE): Allow the target to override.
* configure: Regenerate.
* include/ffi.h.in: Don't define ffi_type_foo if
LIBFFI_HIDE_BASIC_TYPES is defined.
(ffi_type_longdouble): If not HAVE_LONG_DOUBLE, define
to ffi_type_double.
* types.c (LIBFFI_HIDE_BASIC_TYPES): Define.
(FFI_TYPEDEF, ffi_type_void): Mark the data const.
(ffi_type_longdouble): Special case for Alpha. Don't define
if long double == double.
* src/alpha/ffi.c (FFI_TYPE_LONGDOUBLE): Assert unique value.
(ffi_prep_cif_machdep): Handle it as the 128-bit type.
(ffi_call, ffi_closure_osf_inner): Likewise.
(ffi_closure_osf_inner): Likewise. Mark hidden.
(ffi_call_osf, ffi_closure_osf): Mark hidden.
* src/alpha/ffitarget.h (FFI_LAST_ABI): Tidy definition.
* src/alpha/osf.S (ffi_call_osf, ffi_closure_osf): Mark hidden.
(load_table): Handle 128-bit long double.
* testsuite/libffi.call/float4.c: Add -mieee for alpha.
From-SVN: r123622
2007-04-06 Arnaud Charlet <charlet@adacore.com>
Eric Botcazou <botcazou@adacore.com>
* gnatvsn.ads, comperr.adb (Get_Gnat_build_Type): Renamed Build_Type
and made constant.
* comperr.ads, comperr.adb (Compiler_Abort): Add third parameter
Fallback_Loc. Use it as the sloc info when Current_Error_Node doesn't
carry any.
* fe.h (Compiler_Abort): Add third parameter.
* misc.c (internal_error_function): Build third argument from current
input location and pass it to Compiler_Abort.
From-SVN: r123610
2007-04-06 Eric Botcazou <botcazou@adacore.com>
Olivier Hainque <hainque@adacore.com>
* utils.c (update_pointer_to): Make a copy of the couple of FIELD_DECLs
when updating the contents of the old pointer to an unconstrained array.
(end_subprog_body): Set error_gnat_node to Empty.
(write_record_type_debug_info): Do not be unduly sparing with our bytes.
(unchecked_convert): For subtype to base type conversions, require that
the source be a subtype if it is an integer type.
(builtin_decls): New global, vector of available builtin functions.
(gnat_pushdecl): Add global builtin function declaration nodes to the
builtin_decls list.
(gnat_install_builtins): Adjust comments.
(builtin_function): Set DECL_BUILTIN_CLASS and DECL_FUNCTION_CODE before
calling gnat_pushdecl, so that it knows when it handed a builtin
function declaration node.
(builtin_decl_for): Search the builtin_decls list.
From-SVN: r123609
2007-04-06 Olivier Hainque <hainque@adacore.com>
Eric Botcazou <botcazou@adacore.com>
* trans.c (call_to_gnu) <TYPE_RETURNS_BY_TARGET_PTR_P>: Return an
expression with a COMPOUND_EXPR including the call instead of emitting
the call directly here.
(gnat_to_gnu) <N_Slice>: Do not return a non-constant low bound if the
high bound is constant and the slice is empty. Tidy.
(tree_transform, case N_Op_Not): Handle properly the case where the
operation applies to a private type whose full view is a modular type.
(Case_Statement_To_gnu): If an alternative is an E_Constant with an
Address_Clause, use the associated Expression as the GNAT tree
representing the choice value to ensure the corresponding GCC tree is
of the proper kind.
(maybe_stabilize_reference): Stabilize COMPOUND_EXPRs as a whole
instead of just the operands, as the base GCC stabilize_reference does.
<CALL_EXPR>: New case. Directly stabilize the call if an lvalue is not
requested; otherwise fail.
(addressable_p) <COMPONENT_REF>: Do not test DECL_NONADDRESSABLE_P.
From-SVN: r123608
2007-04-06 Robert Dewar <dewar@adacore.com>
Arnaud Charlet <charlet@adacore.com>
* a-diroro.ads: Inserted the pragma Unimplemented_Unit
* bindgen.adb (Gen_Output_File_Ada): Generate pragma Ada_95 at start
of files
Add mention of -Sev (set initialize_scalars option from environment
variable at run time) in gnatbind usage message.
* elists.ads, elists.adb: (Append_Unique_Elmt): New procedure
* fname-uf.ads: Minor comment fix
* osint.ads: Change pragma Elaborate to Elaborate_All
* par-load.adb: Add documentation.
* sem_cat.ads, sem_cat.adb: Minor code reorganization
* s-parint.ads (RCI_Locator) : Add 'Version' generic formal
* s-secsta.ads: Extra comments
* s-soflin.ads: Minor comment fixes
* s-stratt.ads (Block_Stream_Ops_OK): Removed.
* s-wchcon.ads: Minor comment addition
* treepr.adb: Minor change in message
(Print_Name,Print_Node): Make these debug printouts more robust: print
"no such..." instead of crashing on bad input.
From-SVN: r123606
2007-04-06 Eric Botcazou <botcazou@adacore.com>
* s-stchop-vxworks.adb:
(Stack_Check): Raise Storage_Error if the argument has wrapped around.
From-SVN: r123605
2007-04-06 Olivier Hainque <hainque@adacore.com>
* utils2.c (known_alignment): Handle COMPOUND_EXPR, COND_EXPR and
BIT_AND_EXPR. Handle also VIEW_CONVERT_EXPR, as the other conversion
opcodes.
From-SVN: r123604
2007-04-06 Thomas Quinot <quinot@adacore.com>
* uintp.ads, uintp.adb (UI_Div_Rem): New subprogram, extending previous
implementation of UI_Div.
(UI_Div): Reimplement as a call to UI_Div_Rem.
(UI_Rem): Take advantage of the fact that UI_Div_Rem provides the
remainder, avoiding the cost of a multiplication and a subtraction.
(UI_Modular_Inverse): Take advantage of the fact that UI_Div_Rem
provides both quotient and remainder in a single computation.
(UI_Modular_Exponentiation, UI_Modular_Inverse): New modular arithmetic
functions for uint.
(UI_Modular_Inverse): Add a note that the behaviour of this subprogram
is undefined if the given n is not inversible.
From-SVN: r123603
2007-04-06 Olivier Hainque <hainque@adacore.com>
* tracebak.c (PC_ADJUST - ia64): -4 instead of -16, expected to yield
an address always within the call instruction from a return address.
From-SVN: r123602
2007-04-06 Ed Schonberg <schonberg@adacore.com>
Robert Dewar <dewar@adacore.com>
* sinfo.ads, sinfo.adb (Coextensions): New element list for allocators,
to chain nested components that are allocators for access discriminants
of the enclosing object.
Add N_Push and N_Pop nodes
New field Exception_Label added
(Local_Raise_Statements): New field in N_Exception_Handler_Node
(Local_Raise_Not_OK): New flag in N_Exception_Handler_Node
(Is_Coextension): New flag for allocators, to mark allocators that
correspond to access discriminants of dynamically allocated objects.
(N_Block_Statement): Document the fact that the corresponding entity
can be an E_Return_Statement.
(Is_Coextension): New flag for allocators.
Remove all code for DSP option
* sprint.ads, sprint.adb: Display basic information for class_wide
subtypes. Add handling of N_Push and N_Pop nodes
From-SVN: r123600
2007-04-06 Ed Schonberg <schonberg@adacore.com>
Javier Miranda <miranda@adacore.com>
* sem_util.ads, sem_util.adb (Object_Access_Level): If the object is a
dereference of a local object R created as a reference to another
object O, use the access level of O.
(Matches_Prefixed_View_Profile): Use common predicate Conforming_Types,
rather than local Same_Formal_Type, to check whether protected operation
overrides an inherited one.
(Same_Formal_Type): New predicate, used when matching signatures of
overriding synchronized operations, to handle the case when a formal
has a type that is a generic actual.
(Is_Aliased_View): Replace check on E_Task_Type and E_Protected_Type by
predicate Is_Concurrent_Type. This ensures supportin case of subtypes.
(Needs_One_Actual): New predicate, for Ada 2005 use, to resolve
syntactic ambiguities involving indexing of function calls that return
arrays.
(Abstract_Interface_List): New subprogram that returns the list of
abstract interfaces associated with a concurrent type or a
concurrent record type.
(Interface_Present_In_Parent): New subprogram used to check if a
given type or some of its parents implement a given interface.
(Collect_Abstract_Interfaces): Add support for concurrent types
with interface types.
(Has_Abstract_Interfaces): Add support for concurrent types with
interface types.
(Is_Parent): New subprogram that determines whether E1 is a parent
of E2. For a concurrent type its parent is the first element of its
list of interface types; for other types this function provides the
same result than Is_Ancestor.
(Enclosing_Subprogram): Add test for N_Extended_Return_Statement.
(Collect_Synchronized_Interfaces): Removed because the subprogram
Collect_Abstract_Interfaces provides this functionality.
(Collect_Abstract_Interfaces): Minor update to give support to
concurrent types and thus avoid undesired code duplication.
(Get_Subprogram_Entity): Handle entry calls.
(May_Be_Lvalue): Include actuals that appear as in-out parameters in
entry calls.
(Enter_Name): Do not give -gnatwh hiding warning for record component
entities, they never result in hiding.
From-SVN: r123599
2007-04-06 Ed Schonberg <schonberg@adacore.com>
Javier Miranda <miranda@adacore.com>
* sem_type.ads, sem_type.adb (Has_Abstract_Interpretation): Make
predicate recursive, to handle complex expressions on literals whose
spurious ambiguity comes from the abstract interpretation of some
subexpression.
(Interface_Present_In_Ancestor): Add support to concurrent record
types.
(Add_One_Interp,Disambiguate): Split Is_Abstract flag into
Is_Abstract_Subprogram and Is_Abstract_Type.
From-SVN: r123598
2007-04-06 Ed Schonberg <schonberg@adacore.com>
Robert Dewar <dewar@adacore.com>
* sem_ch8.adb (Has_Components): If the argument is an incomplete type
that is a limited view, check the non-limited view if available.
(Undefined): Refine error message for missing with of Text_IO
(Find_Expanded_Name): Use Is_Known_Unit for more accurate error message
to distinguish real missing with cases.
Fix format of all missing with messages
(Analyze_Subprogram_Renaming): Emit proper error message on illegal
renaming as body when renamed entity is abstract.
From-SVN: r123597
2007-04-06 Ed Schonberg <schonberg@adacore.com>
Thomas Quinot <quinot@adacore.com>
* sem_ch7.ads, sem_ch7.adb (Inspect_Deferred_Constant_Completion): Move
out of Analyze_Package_Declaration, because processing must be applied
to package bodies as well, for deferred constants completed by pragmas.
(Analyze_Package_Declaration): When the package declaration being
analyzed does not require an explicit body, call Check_Completion.
(May_Need_Implicit_Body): An implicit body is required when a package
spec contains the declaration of a remote access-to-classwide type.
(Analyze_Package_Body): If the package contains RACWs, append the
pending subprogram bodies generated by exp_dist at the end of the body.
(New_Private_Type,Unit_Requires_Body): Split Is_Abstract flag into
Is_Abstract_Subprogram and Is_Abstract_Type.
(Preserve_Full_Attributes): The full entity list is not an attribute
that must be preserved from full to partial view.
* sem_dist.adb (Add_RAS_Dereference_TSS):
Change primitive name to _Call so it cannot clash with any legal
identifier, and be special-cased in Check_Completion.
Mark the full view of the designated type for the RACW associated with
a RAS as Comes_From_Source to get proper view switching when installing
private declarations.
Provite a placeholder nested package body along with the nested spec
to have a place for Append_RACW_Bodies to generate the calling stubs
and stream attributes.
From-SVN: r123596
2007-04-06 Ed Schonberg <schonberg@adacore.com>
Robert Dewar <dewar@adacore.com>
* sem_ch5.adb (Analyze_Assignment): Reject a right-hand side that is a
tag-indeterminate call to an abstract function, when the left-hand side
is not classwide.
(Analyze_Loop_Statement): Improve detection of infinite loops
From-SVN: r123595
2007-04-06 Ed Schonberg <schonberg@adacore.com>
Bob Duff <duff@adacore.com>
Gary Dismukes <dismukes@adacore.com>
* sem_ch4.adb (Try_Primitive_Operation): The call is legal if the
prefix type is a discriminated subtype of the type of the formal.
(Analyze_Allocator): Collect all coextensions regardless of the context.
Whether they can be allocated statically is determined in exp_ch4.
(Analyze_Selected_Component): If the prefix is a limited view and the
non-limited view is available, use the non-limited one.
(Operator_Check): For "X'Access = Y'Access" (which is ambiguous, and
therefore illegal), suggest a qualified expression rather than a type
conversion, because a type conversion would be illegal in this context.
(Anayze_Allocator): Trace recursively all nested allocators so that all
coextensions are on the corresponding list for the root. Do no mark
coextensions if the root allocator is within a declaration for a stack-
allocated object, because the access discriminants will be allocated on
the stack as well.
(Analyze_Call): Remove restriction on calls to limited functions for the
cases of generic actuals for formal objects, defaults for formal objects
and defaults for record components.
(Analyze_Allocator): Before analysis, chain coextensions on the proper
element list. Their expansion is delayed until the enclosing allocator
is processed and its finalization list constructed.
(Try_Primitive_Operation): If the prefix is a concurrent type, looks
for an operation with the given name among the primitive operations of
the corresponding record type.
(Analyze_Selected_Component): If the prefix is a task type that
implements an interface, and there is no entry with the given name,
check whether there is another primitive operation (e.g. a function)
with that name.
(Try_Object_Operation, Analyze_One_Call, Try_Indexed_Call): Handle
properly the indexing of a function call written in prefix form, where
the function returns an array type, and all parameters of the function
except the first have defaults.
(Analyze_Equality_Op): If this is a call to an implicit inequality, keep
the original operands, rather than relocating them, for efficiency and
to work properly when an operand is overloaded.
(Analyze_Allocator,Operator_Check,Remove_Abstract_Operations): Split
Is_Abstract flag into Is_Abstract_Subprogram and Is_Abstract_Type.
(Analyze_Selected_Component): If the prefix is a private extension, only
scan the visible components, not those of the full view.
(Try_Primitive_Operation): If the operation is a procedure, collect all
possible interpretations, as for a function, because in the presence of
classwide parameters several primitive operations of the type can match
the given arguments.
From-SVN: r123594
2007-04-06 Ed Schonberg <schonberg@adacore.com>
Gary Dismukes <dismukes@adacore.com>
* sem_ch12.adb (Check_Generic_Actuals): Use first subtype of actual
when capturing size information, instead of base type, which for a
formal array type will be the unconstrained type.
(Analyze_Formal_Object_Declaration): Add check for illegal default
expressions for a formal in object of a limited type.
(Instantiate_Object): Ditto.
(Check_Formal_Package_Instance): Skip entities that are formal objects,
because they were defaulted in the formal package and no check applies
to them.
(Check_Formal_Package_Instance): Extend conformance check to other
discrete types beyond Integer.
(Process_Default): Copy directly the unmatched formal. A generic copy
has already been performed in Analyze_Formal_Package.
(Analyze_Associations): If a formal subprogram has no match, check for
partial parametrization before looking for a default, to prevent
spurious errors.
(Analyze_Package_Instantiation, Analyze_Subprogram_Instantiation): Do
not set the instantiation environment before analyzing the actuals.
Fixes regression on 8515-003 with implementation of AI-133.
Set_Instance_Env checks whether the generic unit is a predefined
unit, in which case the instance must be analyzed with the latest Ada
mode. This setting must take place after analysis of the actuals,
because the actuals must be analyzed and frozen in the Ada mode extant
outside of the current instantiation.
(Save_Env, Restore_Env): Preserve and restore the configuration
parameters so that predefined units can be compiled in the proper Ada
mode.
(Analyze_Formal_Object_Declaration,Analyze_Formal_Subprogram,
Instantiate_Type): Split Is_Abstract flag into Is_Abstract_Subprogram
and Is_Abstract_Type.
(Analyze_Formal_Package): For better error recovery, Add exception
handler to catch Instantion_Error, which can be raised in
Analyze_Associations
From-SVN: r123593
* sem_ch10.adb (Install_Limited_Context_Clauses.
Expand_Limited_With_Clause): Use a new copy of selector name in the
call to Make_With_Clause. This fixes the tree structure for ASIS
purposes. Nothing is changed in the compiler behaviour.
(Process_Body_Clauses): Handle properly use clauses whose prefix is
a package renaming.
(Install_Limited_With_Clauses): Do not install non-limited view when it
is still incomplete.
From-SVN: r123592
2007-04-06 Ed Falis <falis@adacore.com>
* s-carun8.adb, s-carsi8.adb (Compare_Array_?8): modify so that last
full word is no longer compared twice.
From-SVN: r123591