Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
The pr96024.f90 testcase ICEs on big-endian hosts. The problem is
that length->val.integer is accessed after checking
length->expr_type == EXPR_CONSTANT, but it is a CHARACTER constant
which uses length->val.character union member instead and on big-endian
we end up reading constant 0x100000000 rather than some small number
on little-endian and if target doesn't have enough memory for 4 times
that (i.e. 16GB allocation), it ICEs.
2023-06-09 Jakub Jelinek <jakub@redhat.com>
PR fortran/96024
* primary.c (gfc_convert_to_structure_constructor): Only do
constant string ctor length verification and truncation/padding
if constant length has INTEGER type.
(cherry picked from commit 4cf6e322adc19f927859e0a5edfa93cec4b8c844)
|
|
|
|
The first testcase in the PR (which I haven't included in the patch because
it is unclear to me if it is supposed to be valid or not) ICEs since extra
hash table checking has been added recently. The problem is that
gfc_trans_use_stmts does
tree *slot = entry->decls->find_slot_with_hash (rent->use_name, hash,
INSERT);
if (*slot == NULL)
and later on doesn't store anything into *slot and continues. Another spot
a few lines later correctly clears the slot if it decides not to use the
slot, so the following patch does the same.
2023-02-03 Jakub Jelinek <jakub@redhat.com>
PR fortran/108451
* trans-decl.c (gfc_trans_use_stmts): Call clear_slot before
doing continue.
(cherry picked from commit 76f7f0eddcb7c418d1ec3dea3e2341ca99097301)
|
|
As reported in the PR, the FUNCTION_TYPE for __builtin_realloc in the
Fortran FE is wrong since r0-100026-gb64fca63690ad which changed
- tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node);
- tmp = tree_cons (NULL_TREE, size_type_node, tmp);
- ftype = build_function_type (pvoid_type_node, tmp);
+ ftype = build_function_type_list (pvoid_type_node,
+ size_type_node, pvoid_type_node,
+ NULL_TREE);
gfc_define_builtin ("__builtin_realloc", ftype, BUILT_IN_REALLOC,
"realloc", false);
The return type is correct, void *, but the first argument should be
void * too and only second one size_t, while the above change changed
realloc to be void *__builtin_realloc (size_t, void *);
I went through all other changes from that commit and found that
__builtin_sincos{,f,l} got broken as well, instead of the former
void __builtin_sincos{,f,l} (ftype, ftype *, ftype *);
where ftype is {double,float,long double} it is now incorrectly
void __builtin_sincos{,f,l} (ftype *, ftype *);
The following patch fixes that, plus some formatting issues around
the spots I've changed.
2023-01-11 Jakub Jelinek <jakub@redhat.com>
PR fortran/108349
* f95-lang.c (gfc_init_builtin_function): Fix up function types
for BUILT_IN_REALLOC and BUILT_IN_SINCOS{F,,L}. Formatting fixes.
(cherry picked from commit 0986c351aa8a9f08b3cb614baec13564dd62c114)
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/109511
* simplify.c (gfc_simplify_set_exponent): Fix implementation of
compile-time simplification of intrinsic SET_EXPONENT for argument
X < 1 and for I < 0.
gcc/testsuite/ChangeLog:
PR fortran/109511
* gfortran.dg/set_exponent_1.f90: New test.
(cherry picked from commit fa4cb42870df60deb8888dbd51e2ddc6d6ab9e6a)
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/109186
* simplify.c (gfc_simplify_nearest): Fix off-by-one error in setting
up real kind-specific maximum exponent for mpfr.
gcc/testsuite/ChangeLog:
PR fortran/109186
* gfortran.dg/nearest_6.f90: New test.
(cherry picked from commit 4410a08b80cc40342eeaa5b6af824cd4352b218c)
|
|
gcc/fortran/ChangeLog:
PR fortran/85877
* resolve.c (resolve_fl_procedure): Check for an explicit interface
of procedures with the BIND(C) attribute (F2018:15.4.2.2).
gcc/testsuite/ChangeLog:
PR fortran/85877
* gfortran.dg/pr85877.f90: New test.
(cherry picked from commit 5426ab34643d9e6502f3ee572891a03471fa33ed)
|
|
|
|
In the bounds check for copying of class expressions, the number of elements
determined from a descriptor, returned as type gfc_array_index_type (i.e. a
signed type), should be converted to the type of the passed element count,
which is of type size_type_node (i.e. unsigned), for use in comparisons.
gcc/fortran/ChangeLog:
PR fortran/106945
* trans-expr.c (gfc_copy_class_to_class): Convert element counts in
bounds check to common type for comparison.
gcc/testsuite/ChangeLog:
PR fortran/106945
* gfortran.dg/pr106945.f90: New test.
(cherry picked from commit 2cf5f485e0351bb1faf46196a99e524688f3966e)
|
|
gcc/fortran/ChangeLog:
PR fortran/104332
* resolve.c (resolve_symbol): Avoid NULL pointer dereference while
checking a symbol with the BIND(C) attribute.
gcc/testsuite/ChangeLog:
PR fortran/104332
* gfortran.dg/bind_c_usage_34.f90: New test.
(cherry picked from commit e20e5d9dc11b64e8eabce6803c91cb5768207083)
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/108937
* trans-intrinsic.c (gfc_conv_intrinsic_ibits): Handle corner case
LEN argument of IBITS equal to BITSIZE(I).
gcc/testsuite/ChangeLog:
PR fortran/108937
* gfortran.dg/ibits_2.f90: New test.
(cherry picked from commit 6cce953ebec274f1468d5d3a0697cf05bb43b8f6)
|
|
gcc/fortran/ChangeLog:
PR fortran/96024
* resolve.c (resolve_component): The type of a CHARACTER length
expression must be INTEGER.
gcc/testsuite/ChangeLog:
PR fortran/96024
* gfortran.dg/pr96024.f90: New test.
(cherry picked from commit 31303c9b5bab200754cdb7ef8cd91ae4918f3018)
|
|
gcc/fortran/ChangeLog:
PR fortran/96025
* parse.c (check_function_result_typed): Improve type check of
specification expression for character length and return status.
(parse_spec): Use status from above.
* resolve.c (resolve_fntype): Prevent use of invalid specification
expression for character length.
gcc/testsuite/ChangeLog:
PR fortran/96025
* gfortran.dg/pr96025.f90: New test.
(cherry picked from commit 6c1b825b3d6499dfeacf7c79dcf4b56a393ac204)
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/95107
* trans-decl.c (gfc_finish_var_decl): With -fno-automatic, do not
make ASSOCIATE variables TREE_STATIC.
gcc/testsuite/ChangeLog:
PR fortran/95107
* gfortran.dg/save_7.f90: New test.
(cherry picked from commit c36f3da534e7f411c5bc48c5b6b660e238167480)
|
|
The testcase for PR108527 uncovered a latent issue with invalid array
sections that resulted in different paths being taken on different
architectures. Detect the invalid array declaration for a clean recovery.
gcc/fortran/ChangeLog:
PR fortran/108609
* expr.c (find_array_section): Add check to prevent interpreting an
mpz non-integer constant as an integer.
gcc/testsuite/ChangeLog:
PR fortran/108609
* gfortran.dg/pr108527.f90: Adjust test pattern.
(cherry picked from commit 88a2a09dd4529107e7ef7a6e7ce43acf96457173)
|
|
gcc/fortran/ChangeLog:
PR fortran/108527
* resolve.c (compare_bound_int): Expression to compare must be of
type INTEGER.
(compare_bound_mpz_t): Likewise.
(check_dimension): Fix comment on checks applied to array section
and clean up associated logic.
gcc/testsuite/ChangeLog:
PR fortran/108527
* gfortran.dg/pr108527.f90: New test.
Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
(cherry picked from commit 22afa4947584c701633a79fd8750c9ceeaa96711)
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/108529
* simplify.c (simplify_transformation): Do not try to simplify
transformational intrinsic when the ARRAY argument has a NULL shape.
gcc/testsuite/ChangeLog:
PR fortran/108529
* gfortran.dg/pr108529.f90: New test.
(cherry picked from commit 6c96382eed96a9285611f2e3e2e59557094172b8)
|
|
gcc/fortran/ChangeLog:
PR fortran/106209
* decl.c (add_init_expr_to_sym): Handle bad initializers for
implied-shape arrays.
gcc/testsuite/ChangeLog:
PR fortran/106209
* gfortran.dg/pr106209.f90: New test.
Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
(cherry picked from commit 748f8a8b145dde59c7b63aa68b5a59515b7efc49)
|
|
gcc/fortran/ChangeLog:
PR fortran/108501
* interface.c (get_expr_storage_size): Check array subscript triplets
that we actually have integer values before trying to extract with
mpz_get_si.
gcc/testsuite/ChangeLog:
PR fortran/108501
* gfortran.dg/pr108501.f90: New test.
(cherry picked from commit 771d793df1622a476e1cf8d05f0a6aee350fa56b)
|
|
gcc/fortran/ChangeLog:
PR fortran/108502
* dependency.c (gfc_check_dependency): Prevent NULL pointer
dereference while recursively checking expressions.
gcc/testsuite/ChangeLog:
PR fortran/108502
* gfortran.dg/pr108502.f90: New test.
(cherry picked from commit 51767f31878a95161142254dca7119b409699670)
|
|
gcc/fortran/ChangeLog:
PR fortran/108421
* interface.c (get_expr_storage_size): Check that we actually have
an integer value before trying to extract it with mpz_get_si.
gcc/testsuite/ChangeLog:
PR fortran/108421
* gfortran.dg/pr108421.f90: New test.
(cherry picked from commit a75760374ee54768e5fd6a27080698bfbbd041ab)
|
|
gcc/fortran/ChangeLog:
PR fortran/108420
* iresolve.c (check_charlen_present): Preserve character length if
there is no array constructor.
gcc/testsuite/ChangeLog:
PR fortran/108420
* gfortran.dg/pr108420.f90: New test.
(cherry picked from commit e6669c0a50ed8aee9e5997d61e6271668d149218)
|
|
gcc/fortran/ChangeLog:
PR fortran/108453
* match.c (gfc_match_common): A USE associated name shall not appear
in a COMMON block (F2018:C8121).
gcc/testsuite/ChangeLog:
PR fortran/108453
* gfortran.dg/common_27.f90: New test.
(cherry picked from commit aba9ff8f30d4245294ea2583de1dc28f1c7ccf7b)
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/108131
* array.c (match_array_element_spec): Avoid too early simplification
of matched array element specs that can lead to a misinterpretation
when used as array bounds in array declarations.
gcc/testsuite/ChangeLog:
PR fortran/108131
* gfortran.dg/pr103505.f90: Adjust expected patterns.
* gfortran.dg/pr108131.f90: New test.
(cherry picked from commit 6a95f0e0a06d78d94138d4c3dd64d41591197281)
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/107872
* resolve.c (derived_inaccessible): Skip over allocatable components
to prevent an infinite loop.
gcc/testsuite/ChangeLog:
PR fortran/107872
* gfortran.dg/pr107872.f90: New test.
(cherry picked from commit 01254aa2eb766c7584fd047568d7277d4d65d067)
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/107576
* interface.c (gfc_procedure_use): Reject NULL as actual argument
when there is no explicit procedure interface.
gcc/testsuite/ChangeLog:
PR fortran/107576
* gfortran.dg/null_actual_3.f90: New test.
(cherry picked from commit 820c25c83561085f54268bd536f9d216d03c3e18)
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/103413
* symbol.c (gfc_type_compatible): A boz-literal-constant has no type
and thus is not considered compatible to any type.
gcc/testsuite/ChangeLog:
PR fortran/103413
* gfortran.dg/illegal_boz_arg_4.f90: New test.
(cherry picked from commit f7d28818179247685f3c101f9f2f16366f56309b)
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/105633
* expr.c (find_array_section): Move check for NULL pointers so
that both subscript triplets and vector subscripts are covered.
gcc/testsuite/ChangeLog:
PR fortran/105633
* gfortran.dg/pr105633.f90: New test.
Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
(cherry picked from commit ecb20df4fa6d99daa635c7fb662dc0554610777e)
|
|
|
|
For actual arguments whose dummy is INTENT(OUT), we used to generate
clobbers on them at the same time we generated the argument reference
for the function call. This was wrong if for an argument coming
later, the value expression was depending on the value of the just-
clobbered argument, and we passed an undefined value in that case.
With this change, clobbers are collected separatedly and appended
to the procedure call preliminary code after all the arguments have been
evaluated.
PR fortran/106817
gcc/fortran/ChangeLog:
* trans-expr.c (gfc_conv_procedure_call): Collect all clobbers
to their own separate block. Append the block of clobbers to
the procedure preliminary block after the argument evaluation
codes for all the arguments.
gcc/testsuite/ChangeLog:
* gfortran.dg/intent_optimize_4.f90: New test.
(cherry picked from commit 29919bf3b6449bafd02e795abbb1966e3990c1fc)
|
|
The fortran frontend, as result symbol for a function without
declared result symbol, uses the function symbol itself. This caused
an invalid clobber of a function decl to be emitted, leading to an
ICE, whereas the intended behaviour was to clobber the function result
variable. This change fixes the problem by getting the decl from the
just-retrieved variable reference after the call to
gfc_conv_expr_reference, instead of copying it from the frontend symbol.
PR fortran/105012
gcc/fortran/ChangeLog:
* trans-expr.c (gfc_conv_procedure_call): Retrieve variable
from the just calculated variable reference.
gcc/testsuite/ChangeLog:
* gfortran.dg/intent_out_15.f90: New test.
(cherry picked from commit edaf1e005c90b311c39b46d85cea17befbece112)
|
|
This change inlines the clobber generation code from
gfc_conv_expr_reference to the single caller from where the add_clobber
flag can be true, and removes the add_clobber argument.
What motivates this is the standard making the procedure call a cause
for a variable to become undefined, which translates to a clobber
generation, so clobber generation should be closely related to procedure
call generation, whereas it is rather orthogonal to variable reference
generation. Thus the generation of the clobber feels more appropriate
in gfc_conv_procedure_call than in gfc_conv_expr_reference.
Behaviour remains unchanged.
gcc/fortran/ChangeLog:
* trans.h (gfc_conv_expr_reference): Remove add_clobber
argument.
* trans-expr.c (gfc_conv_expr_reference): Ditto. Inline code
depending on add_clobber and conditions controlling it ...
(gfc_conv_procedure_call): ... to here.
(cherry picked from commit 2b393f6f83903cb836676bbd042c1b99a6e7e6f7)
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/100040
PR fortran/100029
* trans-expr.c (gfc_conv_class_to_class): Add code to have
assumed-rank arrays recognized as full arrays and fix the type
of the array assignment.
(gfc_conv_procedure_call): Change order of code blocks such that
the free of ALLOCATABLE dummy arguments with INTENT(OUT) occurs
first.
gcc/testsuite/ChangeLog:
PR fortran/100029
* gfortran.dg/PR100029.f90: New test.
PR fortran/100040
* gfortran.dg/PR100040.f90: New test.
(cherry picked from commit 5299155bb80e90df822e1eebc9f9a0c8e4505a46)
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/100132
* trans-types.c (create_fn_spec): Fix function attributes when
passing polymorphic pointers.
gcc/testsuite/ChangeLog:
PR fortran/100132
* gfortran.dg/PR100132.f90: New test.
(cherry picked from commit be60aa5b608b5f09fadfeff852a46589ac311a42)
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/107054
* simplify.c (gfc_simplify_unpack): Replace assert by condition
that terminates simplification when there are not enough elements
in the constructor of argument VECTOR.
gcc/testsuite/ChangeLog:
PR fortran/107054
* gfortran.dg/pr107054.f90: New test.
(cherry picked from commit 78bc6497fc61bbdacfb416ee0246a775360d9af6)
|