[Patch, RFC] PR fortran/93340 - [8/9/10/11 Regression] fix missed substring simplifications

2021-01-12 Thread Harald Anlauf via Gcc-patches
Dear all, when playing around with the issues exposed by PR93340, particularly visible in the tree dump, I tried to find ways to simplify substrings in those cases where they are eligible as designator, which is required e.g. in DATA statements. Given my limited understanding, I finally arrived

[PATCH] PR fortran/98284 - ICE in get_array_index

2020-12-15 Thread Harald Anlauf via Gcc-patches
Dear all, ICE-on-invalid: testcase by Arseny, draft patch by Steve, slightly polished and regtested by me on x86_64-pc-linux-gnu. OK for master? Thanks, Harald PR fortran/98284 - ICE in get_array_index Reject DATA elements with the ALLOCATABLE attribute also when they are components of a

[PATCH] PR fortran/98307 - Dependency check fails when using "allocatable"

2020-12-16 Thread Harald Anlauf via Gcc-patches
Dear all, since the introduction of check_forall_dependencies() we mishandled the dependencies of ALLOCATABLE components of derived types, while POINTER was dealt with. Fix that. Regtested on x86_64-pc-linux-gnu. OK for master? Since we generate wrong code under the given circumstances, what

[PATCH] PR fortran/95372 - ICE in find_array_section, at fortran/expr.c:1687

2020-12-13 Thread Harald Anlauf via Gcc-patches
ICE on valid code. Original patch by Steve, slightly adjusted and regtested on x86_64-pc-linux-gnu. OK for master? Backports? Should be safe everywhere, as it replaces an assert by an if condition. Thanks, Harald PR fortran/95372 - ICE in find_array_section, at fortran/expr.c:1687 Fix

[PATCH] PR fortran/93685 - [9/10/11 Regression] ICE in gfc_constructor_append_expr, at fortran/constructor.c:135

2020-12-20 Thread Harald Anlauf via Gcc-patches
Dear all, the patch is almost self-explaining. We mishandled the case of initializing pointer components to derived types of type CHARACTER via DATA, which screwed up both legal and illegal uses. The attached patch fixes that, and checks that the legal cases work. Regtests cleanly on

[PATCH] PR fortran/78746 - invalid access after error recovery

2021-01-05 Thread Harald Anlauf via Gcc-patches
Dear all, the PR contains a lengthy discussion of several testcases, some which were considered invalid and thus removed from the testsuite (charlen_03.f90, charlen_10.f90), charlen_15.f90 was resolved elsewhere, so that only class_61.f90 was left with an invalid access after error recovery with

Re: [PATCH] PR fortran/70070 - ICE on initializing character data beyond min/max bound

2021-01-25 Thread Harald Anlauf via Gcc-patches
Hi Thomas, > Gesendet: Montag, 25. Januar 2021 um 19:58 Uhr > Von: "Thomas Koenig" > a.f90:3:10: > > 3 | print a(0:3) >| 1 > Error: Substring start index at (1) is less than one > a.f90:4:10: > > 4 | print a(1:4) >| 1 > Error: Substring end index

[PATCH] PR fortran/98661 - valgrind issues with error recovery

2021-01-13 Thread Harald Anlauf via Gcc-patches
Dear all, the former Fortran testcase charlen_03.f90, which some time ago used to ICE, could still display issues during error recovery. As Dominique pointed out, this required either an instrumented compiler, or valgrind. The issue turned out to not have anything to do with CHARACTER, but with

[PATCH] PR fortran/96381 - invalid read in gfc_find_derived_vtab

2021-01-01 Thread Harald Anlauf via Gcc-patches
Dear all, happy New Year! The testcase committed with the fix for PR93337 uncovered a latent issue with an invalid read that was discovered with an ASAN instrumented compiler but which could also be verified by running f951 under valgrind. According to my gdb sessions the invalid read happens

[PATCH] [8/9/10/11 Regression] [OOP] PR fortran/86470 - ICE with OpenMP

2021-01-27 Thread Harald Anlauf via Gcc-patches
Dear all, the fix for this ICE is obvious: make gfc_call_malloc behave as documented. Apparently the special case in question was not exercised in the testsuite. Regtested on x86_64-pc-linux-gnu. OK for master / backports? Should the testcase be moved to the gomp/ subdirectory? Thanks, Harald

Re: [PATCH] [8/9/10/11 Regression] [OOP] PR fortran/86470 - ICE with OpenMP

2021-01-28 Thread Harald Anlauf via Gcc-patches
Hi Thomas, > > Should the testcase be moved to the gomp/ subdirectory? > Yes. It's a compile-time test, and it will then only be run > if the the compiler can do OpenMP. > > You will not need the > > +! { dg-options "-fopenmp" } > > line, then. Adjusted and committed as

PING [PATCH] PR fortran/95502 - ICE in gfc_check_do_variable, at fortran/parse.c:4446

2021-06-11 Thread Harald Anlauf via Gcc-patches
*PING* BTW this patch also addresses PR95501, so I'll update the Changelog. Thanks, Harald > Gesendet: Freitag, 04. Juni 2021 um 23:12 Uhr > Von: "Harald Anlauf" > An: "fortran" , "gcc-patches" > Betreff: [PATCH] PR fortran/95502 - ICE in gfc_check_do_variable, at > fortran/parse.c:4446 > >

[PATCH] PR fortran/101084 - [10/11/12 Regression] ICE in gfc_typenode_for_spec, at fortran/trans-types.c:1124

2021-06-15 Thread Harald Anlauf via Gcc-patches
A recent change to the checking of legacy FORMAT tags did not handle cases where the type is not set. Adjust the check. Regtested on x86_64-pc-linux-gnu. OK for mainline / 11- / 10-branch? Thanks, Harald Fortran: reject FORMAT tag of unknown type. gcc/fortran/ChangeLog: PR

Re: [PATCH] PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514

2021-06-10 Thread Harald Anlauf via Gcc-patches
Hi Bernhard, > > +static bool > > +substring_has_constant_len (gfc_expr *e) > > +{ > > + ptrdiff_t istart, iend; > > + size_t length; > > + bool equal_length = false; > > + > > + if (e->ts.type != BT_CHARACTER > > + || !(e->ref && e->ref->type == REF_SUBSTRING) > > iff we ever can get

PING [PATCH] PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514

2021-06-18 Thread Harald Anlauf via Gcc-patches
*PING* > Gesendet: Mittwoch, 09. Juni 2021 um 23:39 Uhr > Von: "Harald Anlauf" > An: "fortran" , "gcc-patches" > Betreff: [PATCH] PR fortran/100950 - ICE in output_constructor_regular_field, > at varasm.c:5514 > > Dear Fortranners, > > we should be able to simplify the length of a substring

[Patch, committed] PR fortran/101123 - [11/12 Regression] Invalid code for MAX0 with -fdefault-integer-8

2021-06-18 Thread Harald Anlauf via Gcc-patches
As confirmed in the PR by Jakub, there was a bad conversion of the result of min0/max0 to the result type. We should just unconditionally convert in all cases. As a benefit, this also fixes pr100283. Committed after regtesting. Thanks, Harald Fortran - fix conversion to result type for the

[PATCH] PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514

2021-06-09 Thread Harald Anlauf via Gcc-patches
Dear Fortranners, we should be able to simplify the length of a substring with known constant bounds. The attached patch adds this. Regtested on x86_64-pc-linux-gnu. OK for mainline? Since this should be rather safe, to at least 11-branch? Thanks, Harald Fortran - simplify length of

[PATCH] PR fortran/100602 - [11/12 Regression] Erroneous "pointer argument is not associated" runtime error

2021-05-18 Thread Harald Anlauf via Gcc-patches
The generation of the new runtime check picked up the wrong attributes in the case of CLASS array arguments. There is related new code in gfc_conv_procedure_call which served as reference for the fix. Regtested on x86_64-pc-linux-gnu. OK for mainline / 11-branch? Thanks, Harald Fortran: Fix

[PATCH] PR fortran/98411 - [10/11/12 Regression] Pointless warning for static variables

2021-05-10 Thread Harald Anlauf via Gcc-patches
A simple, self-explaining patch to avoid a wrong warning. Regtested on x86_64-pc-linux-gnu. OK for mainline? Affected branches? Thanks, Harald PR fortran/98411 - Pointless warning for static variables Variables with explicit SAVE attribute cannot end up on the stack. There is no point in

[PATCH] PR fortran/100551 - [11/12 Regression] Passing return value to class(*) dummy argument

2021-05-20 Thread Harald Anlauf via Gcc-patches
The fix for PR93924/5 has caused a regression for code such as given in the present PR. This can be remedied by adjusting the check when to invoke the implicit conversion of actual argument to an unlimited polymorphic procedure argument. Regtested on x86_64-pc-linux-gnu. OK for mainline and

Aw: [Patch] Testsuite/Fortran: gfortran.dg/pr96711.f90 - fix expected value for PowerPC [PR96983]

2021-05-20 Thread Harald Anlauf via Gcc-patches
Hi Tobias, > @All, Harald: Does the attached patch make sense? first of all: sorry for the really badly designed testcase. The best solution has already been discussed in this thread, which is to replace integer(16), parameter :: m1 = 9007199254740992_16!2**53

[PATCH] PR fortran/99839 - [9/10/11/12 Regression] ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234

2021-05-27 Thread Harald Anlauf via Gcc-patches
Dear Fortranners, frontend optimization tries to inline matmul, but then it also needs to take care of the assignment to the result array. If that one is not of canonical type, we currently get an ICE. The straightforward solution is to simply punt in those cases and avoid inlining. Regtested

[PATCH] PR fortran/95502 - ICE in gfc_check_do_variable, at fortran/parse.c:4446

2021-06-04 Thread Harald Anlauf via Gcc-patches
ICE-on-invalid issues during error recovery. Testcase by Gerhard, initial patch by Steve. I found another variant which needed an additional fix for a NULL pointer dereference. Regtested on x86_64-pc-linux-gnu. OK for mainline / 11-branch? Thanks, Harald Fortran - ICE in

PING [PATCH] PR fortran/99839 - [9/10/11/12 Regression] ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234

2021-06-03 Thread Harald Anlauf via Gcc-patches
*PING* > Gesendet: Donnerstag, 27. Mai 2021 um 22:20 Uhr > Von: "Harald Anlauf" > An: "fortran" , "gcc-patches" > Betreff: [PATCH] PR fortran/99839 - [9/10/11/12 Regression] ICE in > inline_matmul_assign, at fortran/frontend-passes.c:4234 > > Dear Fortranners, > > frontend optimization tries

[PATCH] PR fortran/100656 - ICE in gfc_conv_expr_present, at fortran/trans-expr.c:1934

2021-05-26 Thread Harald Anlauf via Gcc-patches
Dear Fortranners, Gerhard found a case where bounds-checking for an optional, allocatable character dummy resulted in an ICE. We'd better not call the presence check on a non-dummy symbol, as this will hit an assert... Regtested on x86_64-pc-linux-gnu. OK for mainline? And backport to 11?

PING [PATCH] PR fortran/100602 - [11/12 Regression] Erroneous "pointer argument is not associated" runtime error

2021-05-25 Thread Harald Anlauf via Gcc-patches
*PING* > Gesendet: Dienstag, 18. Mai 2021 um 20:36 Uhr > Von: "Harald Anlauf" > An: "fortran" , "gcc-patches" > Betreff: [PATCH] PR fortran/100602 - [11/12 Regression] Erroneous "pointer > argument is not associated" runtime error > > The generation of the new runtime check picked up the

*Ping* [PATCH] PR fortran/101084 - [10/11/12 Regression] ICE in gfc_typenode_for_spec, at fortran/trans-types.c:1124

2021-07-12 Thread Harald Anlauf via Gcc-patches
*Ping* > Gesendet: Dienstag, 15. Juni 2021 um 21:31 Uhr > Von: "Harald Anlauf" > An: "fortran" , "gcc-patches" > Betreff: [PATCH] PR fortran/101084 - [10/11/12 Regression] ICE in > gfc_typenode_for_spec, at fortran/trans-types.c:1124 > > A recent change to the checking of legacy FORMAT tags

Re: [PATCH] PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514

2021-07-12 Thread Harald Anlauf via Gcc-patches
Hi Tobias, > On 10.06.21 20:52, Harald Anlauf via Fortran wrote: > > +static bool > > +substring_has_constant_len (gfc_expr *e) > > +{ > > + ptrdiff_t istart, iend; > > + size_t length; > > + bool equal_length = false; > > + > > + if (e->ts.type != BT_CHARACTER > > + || !e->ref > > +

[PATCH] PR fortran/100274 - [9/10/11/12 Regression] ICE in gfc_conv_procedure_call, at fortran/trans-expr.c:6131

2021-04-27 Thread Harald Anlauf via Gcc-patches
Dear Fortranners, Gerhard found a case where the mismatch of actual and formal argument lead to an ICE instead of the relevant warning. Furthermore, the special case of character argument avoided the check that the actual argument must be definable if the formal one is INTENT-OUT or -INOUT. The

Re: [Patch] PR fortran/100218 - target of pointer from evaluation of function-reference

2021-04-24 Thread Harald Anlauf via Gcc-patches
Hi Paul, > Is there a test for an error with -std=f2003? If not, you should, perhaps, > include one. after checking for the corresponding error message, I found that ptr-func-2.f90 already covers this case. Considering this, I'll rename the current testcase from pr100218.f90 to ptr-func-4.f90.

*PING* [PATCH] PR fortran/100274 - [9/10/11/12 Regression] ICE in gfc_conv_procedure_call, at fortran/trans-expr.c:6131

2021-05-04 Thread Harald Anlauf via Gcc-patches
PING! --- Dear Fortranners, Gerhard found a case where the mismatch of actual and formal argument lead to an ICE instead of the relevant warning. Furthermore, the special case of character argument avoided the check that the actual argument must be definable if the formal one is INTENT-OUT or

[PATCH] PR fortran/70070 - ICE on initializing character data beyond min/max bound

2021-01-24 Thread Harald Anlauf via Gcc-patches
Dear all, the attached patch is pretty much self-explaining: check for bounds violation when initializing a substring in a data statement and treat the resulting error. If more detailed information should be emitted with the error message, I'm open for suggestions. Regtested on

[PATCH] PR fortran/99840 - [8/9/10/11 Regression] ICE in gfc_simplify_matmul, at fortran/simplify.c:4777

2021-03-31 Thread Harald Anlauf via Gcc-patches
Dear all, the simplification of the TRANSPOSE of a zero-sized array would lead to an ICE if the result was used in a subsequent simplification of a MATMUL. The reason was the lack of the proper initialization of the shape, which is mpz_t. Use mpz_init_set instead of mpz_set. Regtested on

[PATCH] PR fortran/99112 - [11 Regression] ICE with runtime diagnostics for SIZE intrinsic function

2021-03-12 Thread Harald Anlauf via Gcc-patches
Dear all, the addition of runtime checks for the SIZE intrinsic created a regression that showed up for certain CLASS arguments to procedures. Paul did most of the work (~ 99%), but asked me to dig into an issue with an inappropriately selected error message. This actually turned out to be a

Aw: Re: [PATCH] PR fortran/99112 - [11 Regression] ICE with runtime diagnostics for SIZE intrinsic function

2021-03-14 Thread Harald Anlauf via Gcc-patches
Hi Tobias, > I do not see any reason why 'tmp' is replaced by 'temp' in this > code. Also for doing patch archeology, it helps if there are no > changes unless it makes sense. Adding an -e- does not count ;-) > > Hence, OK with that change. I've corrected that. This also reduces the size of

Aw: Re: [Patch, fortran] PR99602 - [11 regression] runtime error: pointer actual argument not associated

2021-03-16 Thread Harald Anlauf via Gcc-patches
Hi Tobias, > Shouldn't there be also a testcase which triggers this run-time error? The testcase is there, it simply has the wrong dg-foo: ! { dg-do compile } which should be ! { dg-do run } *-*-* There are certainly more cases which should insert checks but currently don't, like:

Re: [PATCH] PR fortran/99205 - [10/11 Regression] Out of memory with undefined character length

2021-03-10 Thread Harald Anlauf via Gcc-patches
Dear Tobias, thanks for your comments. > > A variable that is a data statement object shall be a designator, > > thus a character variable shall have a constant length. > > This comment is wrong: A designator does not imply this – nor is > F2018:C875 violated, not even the substring

Re: [PATCH] PR fortran/99205 - [10/11 Regression] Out of memory with undefined character length

2021-03-10 Thread Harald Anlauf via Gcc-patches
Dear Tobias, all, > The reason that it is not permitted is the "automatic data object" > (see *...* highlighted parts in the quote): > > C876 (R839) A *variable* whose *designator* appears as a > *data-stmt-object* or a data-i-do-object hall not be a > dummy argument, accessed by use or host

[PATCH] PR fortran/99205 - [10/11 Regression] Out of memory with undefined character length

2021-03-09 Thread Harald Anlauf via Gcc-patches
Dear all, character variables with undefined length are not allowed as objects in DATA statements. We better reject them. Regtested on x86_64-pc-linux-gnu. OK for master / backport? Thanks, Harald PR fortran/99205 - Out of memory with undefined character length A variable that is a data

[Patch, part1] PR fortran/49278 - ICE when combining DATA with default initialization

2021-03-01 Thread Harald Anlauf via Gcc-patches
Dear all, the present PR has two issues. The first one, addressed by this patch, was about accepting invalid code where a variable appeared both in a declaration with PARAMETER as well as in a DATA statement, which could lead to an ICE. We now reject this. (There is a separate issue about

*PING* [PATCH] PR libfortran/99218 - [8/9/10/11 Regression] matmul on temporary array accesses invalid memory

2021-03-01 Thread Harald Anlauf via Gcc-patches
Early ping. Harald > Gesendet: Dienstag, 23. Februar 2021 um 22:46 Uhr > Von: "Harald Anlauf" > An: "fortran" , "gcc-patches" > Betreff: [PATCH] PR libfortran/99218 - [8/9/10/11 Regression] matmul on > temporary array accesses invalid memory > > Dear all, > > under certain circumstances a

Aw: Re: [PATCH] PR libfortran/99218 - [8/9/10/11 Regression] matmul on temporary array accesses invalid memory

2021-03-04 Thread Harald Anlauf via Gcc-patches
Hi Jerry, > Yes, OK, however, have you been able to test performance. I am only > curious. There was a test program we used back when this code was first > implemented in bugzilla. I do not remember the PR number off hand. as you mentioned in a private mail, it was PR51119, and the timing

[PATCH] PR libfortran/99218 - [8/9/10/11 Regression] matmul on temporary array accesses invalid memory

2021-02-23 Thread Harald Anlauf via Gcc-patches
Dear all, under certain circumstances a call to MATMUL for rank-2 times rank-1 would invoke a highly tuned rank-2 times rank-2 algorithm which could lead to invalid reads and writes. The solution is to check the rank of the second argument to matmul and fall back to a regular algorithm for

[PATCH] PR fortran/63797 - Bogus ambiguous reference to 'sqrt'

2021-04-15 Thread Harald Anlauf via Gcc-patches
Hello everybody, we currently write the interface for intrinsic procedures to module files although that should not be necessary. (F2018:15.4.2.1 actually states that interfaces e.g. of intrinsic procedures are 'explicit'.) This lead to bogus errors due to an apparently bogus ambiguity. A simple

Re: [PATCH] PR fortran/63797 - Bogus ambiguous reference to 'sqrt'

2021-04-16 Thread Harald Anlauf via Gcc-patches
Hi Paul, all,   having really enjoyed the review process, I've now committed Paul's version including his comment. See also attached. Thanks, Harald   Gesendet: Freitag, 16. April 2021 um 13:02 Uhr Von: "Paul Richard Thomas" An: "Bernhard Reutner-Fischer" Cc: "Harald Anlauf via Fortran" ,

[PATCH] PR fortran/99147 - Sanitizer detects heap-use-after-free in gfc_add_flavor

2021-02-18 Thread Harald Anlauf via Gcc-patches
Dear all, the PR reports an issue detected with an ASAN instrumented compiler, which can also be verified with valgrind. It appears that the state of gfc_new_block could be such that it should not be dereferenced. Reversing the order of condition evaluation helped. I failed to find out why this

[PATCH] PR fortran/99169 - [9/10/11 Regression] Segfault when passing allocatable scalar into intent(out) dummy argument

2021-02-19 Thread Harald Anlauf via Gcc-patches
Dear all, we should not clobber the pointer in case of an allocatable scalar being an intent(out) dummy argument to a procedure. Regtested on x86_64-pc-linux-gnu. OK for master? Since this is a regression, also for backports to 10/9? Thanks, Harald PR fortran/99169 - Do not clobber

[PATCH] PR fortran/99206 - [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980

2021-02-22 Thread Harald Anlauf via Gcc-patches
Dear all, when simplifying the RESHAPE intrinsic we lost the string length when the resulting array had size zero. The attached patch sets the resulting length from the source. Regtested on x86_64-pc-linux-gnu. OK for mainline? Thanks, Harald PR fortran/99206 - ICE in add_init_expr_to_sym,

[Patch] PR fortran/100154 - [9/10/11/12 Regression] ICE in gfc_conv_procedure_call, at fortran/trans-expr.c:6131

2021-04-22 Thread Harald Anlauf via Gcc-patches
Dear Fortranners, we need to check the arguments to the affected GNU intrinsic extensions properly, and - as pointed out in the PR by Tobias - we need to allow function references that have a data pointer result. Also the argument names of the character arguments of the subroutine versions

[Patch] PR fortran/100154 - [9/10/11/12 Regression] ICE in gfc_conv_procedure_call, at fortran/trans-expr.c:6131

2021-04-22 Thread Harald Anlauf via Gcc-patches
Now with the correct patch attached ... Sorry for the confusion! --- Dear Fortranners, we need to check the arguments to the affected GNU intrinsic extensions properly, and - as pointed out in the PR by Tobias - we need to allow function references that have a data pointer result. Also the

[Patch] PR fortran/100218 - target of pointer from evaluation of function-reference

2021-04-22 Thread Harald Anlauf via Gcc-patches
Dear Fortranners, while analyzing a different PR (PR100154), Tobias pointed out that the target of a pointer from the evaluation of function-reference is allowed to be used in a variable definition context and thus as an actual argument to a function or subroutine. This seems to be a more

Aw: Re: [PATCH] PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514

2021-08-20 Thread Harald Anlauf via Gcc-patches
Hi Jakob, thanks for the detailed explanation! > The other much easier but uglier option is to use a temporary buffer: > char buffer[21]; > sprintf (buffer, HOST_WIDE_INT_PRINT_DEC, hwint_val); > gfc_error ("... %s ...", ... buffer ...); > This works, as it uses the host sprintf i.e.

[PATCH, committed] Fix bootstrap breakage caused by r12-3033 (PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514)

2021-08-20 Thread Harald Anlauf via Gcc-patches
Dear all, I've just pushed the fix for the bootstrap breakage as confirmed by Jakub. commit r12-3043-g12f22906d3c025e7edb60e3264dc9cd27a49e3e1 Author: Harald Anlauf Date: Fri Aug 20 13:38:00 2021 +0200 Fortran - use temporary char buffer for passing HOST_WIDE_INT to gfc_error

Aw: Re: Re: [PATCH] PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514

2021-08-20 Thread Harald Anlauf via Gcc-patches
> Gesendet: Freitag, 20. August 2021 um 12:12 Uhr > Von: "Jakub Jelinek" > I have verified it fixes i686-linux bootstrap. > But the new testcase doesn't trigger any of those new errors, is something > else in the testsuite covering those or do you have some short snippet that > could verify the

Aw: Re: Re: Re: [PATCH] PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514

2021-08-20 Thread Harald Anlauf via Gcc-patches
> Gesendet: Freitag, 20. August 2021 um 14:01 Uhr > Von: "Tobias Burnus" > On 20.08.21 12:53, Harald Anlauf wrote: > > > I played with variations of the testcase by specifying illegal > > substring bounds, but all these cases were caught in a different > > spot with similar error messages. > >

Re: [PATCH] PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514

2021-08-20 Thread Harald Anlauf via Gcc-patches
Hi! > Gesendet: Freitag, 20. August 2021 um 02:21 Uhr > Von: "H.J. Lu" > This may have broken bootstrap on 32-bit hosts: > > https://gcc.gnu.org/pipermail/gcc-regression/2021-August/075209.html I do not understand the error message: ../../src-master/gcc/fortran/simplify.c: In function ‘bool

Re: [PATCH] PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514

2021-08-18 Thread Harald Anlauf via Gcc-patches
Hi Tobias, > Gesendet: Mittwoch, 18. August 2021 um 12:22 Uhr > Von: "Tobias Burnus" > > Note, however, that gfc_simplify_len still won't handle neither > > deferred strings nor their substrings. > > > > I think there is nothing to simplify at compile time here. > > Obviously, nonsubstrings

[PATCH] PR fortran/87737 - ICE tree check: expected ssa_name, have addr_expr in remap_gimple_op_r, at tree-inline.c:923

2021-08-27 Thread Harald Anlauf via Gcc-patches
Dear all, the ICE in the original testcase does no longer occur but leads to an error in a later stage of compilation, and we accepted invalid code. (Cross-checked with other compilers, such as Intel and NAG). F2018 states: 15.6.2.6 ENTRY statement (3) ... If the characteristics of the result

[PATCH] PR fortran/56985 - gcc/fortran/resolve.c:920: "'%s' in cannot appear in COMMON ..."

2021-08-31 Thread Harald Anlauf via Gcc-patches
I intend to commit the fix to the error message using the patch below within the next 24h unless there are objections or better suggestions. The unchanged part of the error message is already covered by gcc/testsuite/gfortran.dg/unlimited_polymorphic_2.f03 and does not need to be adapted.

*PING* [PATCH] PR fortran/93834 - [9/10/11/12 Regression] ICE in trans_caf_is_present, at fortran/trans-intrinsic.c:8469

2021-08-31 Thread Harald Anlauf via Gcc-patches
PING! > Gesendet: Dienstag, 24. August 2021 um 22:36 Uhr > Von: "Harald Anlauf" > An: "fortran" , "gcc-patches" > Betreff: [PATCH] PR fortran/93834 - [9/10/11/12 Regression] ICE in > trans_caf_is_present, at fortran/trans-intrinsic.c:8469 > > Dear Fortranners, > > here's a pretty obvious one:

[PATCH] PR fortran/93834 - [9/10/11/12 Regression] ICE in trans_caf_is_present, at fortran/trans-intrinsic.c:8469

2021-08-24 Thread Harald Anlauf via Gcc-patches
Dear Fortranners, here's a pretty obvious one: we didn't properly check the arguments for intrinsics when these had to be ALLOCATABLE and in the case that argument was a coarray object. Simple solution: just reuse a check that was used for pointer etc. Regtested on x86_64-pc-linux-gnu. OK for

[PATCH, committed] PR fortran/101349 - ICE in gfc_get_descriptor_field, at fortran/trans-array.c:140

2021-08-30 Thread Harald Anlauf via Gcc-patches
The check of arguments to ALLOCATE did not properly implement F2008:C628 / F2018:C932, as it excluded unlimited polymophics, in contrast to the standard text. Fix this. Committed Steve's patch as obvious after regtesting on x86_64-pc-linux-gnu. Thanks, Harald Fortran - correct check for

[PATCH, committed] PR fortran/102113 - parsing error in assigned goto

2021-08-30 Thread Harald Anlauf via Gcc-patches
A whitespace issue during parsing. Committed Steve's patch as obvious after regtesting on x86_64-pc-linux-gnu. Thanks, Harald Fortran - fix whitespace issue during parsing of assigned goto gcc/fortran/ChangeLog: PR fortran/102113 * match.c (gfc_match_goto): Allow for

[PATCH] PR fortran/101327 - ICE in find_array_element, at fortran/expr.c:1355

2021-08-30 Thread Harald Anlauf via Gcc-patches
There was an issue when trying to use an element from an array constructor which was a broken in a way probably only Gerhard could conceive. We hit an assert that can be replaced by more robust code. Patch is basically Steve's. Regtested on x86_64-pc-linux-gnu. OK for mainline? Thanks, Harald

Re: [PATCH] PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514

2021-08-20 Thread Harald Anlauf via Gcc-patches
Hi Tobias, > LGTM – I am fine with either variant, but I am slightly inclined to > removing the gcc_assert* > – as I believe that the existing checks come early enough and do seem to > work well. I played some more and found additional cases that we hadn't discussed before. (At least I hadn't

Re: [PATCH] PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514

2021-08-19 Thread Harald Anlauf via Gcc-patches
Hi Tobias, > I am inclined to say that the Intel compiler has a bug by not > accepting it – but as written before, I regard sub-string length > (esp. with const expr) inquiries as an odd corner case which > is unlikely to occur in real-world code. ok. > Still does not work – or rather:

Re: [PATCH] PR fortran/93834 - [9/10/11/12 Regression] ICE in trans_caf_is_present, at fortran/trans-intrinsic.c:8469

2021-09-02 Thread Harald Anlauf via Gcc-patches
Hi Tobias, > Consider: > > type t >integer, allocatable :: a > end type t > > type(t) :: var[*] > print *, allocated(var%a) > print *, allocated(var[1]%a) > end what is the problem here? Can you elaborate? BTW: Intel accepts it, we (currently) accept it, my patch does not change

[PATCH, committed] PR fortran/98490 - Unexpected out of bounds in array constructor with implied do loop

2021-09-09 Thread Harald Anlauf via Gcc-patches
The following patch by Steve was lingering in the PR for some time. For an implied do loop within an array constructor we would generate an additional, bogus substring bounds check for the index variable before it actually became defined. The check thus depended on the previous value of the

*PING* [PATCH] PR fortran/82314 - ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:6972

2021-09-12 Thread Harald Anlauf via Gcc-patches
Early *PING*. > Gesendet: Dienstag, 07. September 2021 um 23:44 Uhr > Von: "Harald Anlauf" > An: "fortran" , "gcc-patches" > Betreff: [PATCH] PR fortran/82314 - ICE in gfc_conv_expr_descriptor, at > fortran/trans-array.c:6972 > > When adding the initializer for an array, we need to make sure

[PATCH] PR fortran/85130 - Handling of substring range

2021-09-12 Thread Harald Anlauf via Gcc-patches
Dear all, in find_substring_ref we erroneously handled given substring start and end indices as unsigned integers. However, gives indices could be negative, which is legal as long as end < start, leading to a string of length zero. The current behavior could lead to a wrong length as well as an

[PATCH] PR fortran/102287 - optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines

2021-09-14 Thread Harald Anlauf via Gcc-patches
As nicely described in the PR, we mishandled the case of passing optional allocatable DT arguments with allocatable components when the INTENT was declared as INTENT(OUT), as we unconditionally tried to deallocate these components even when the argument was not present. The obvious solution is to

Re: [Patch] Fortran: Handle allocated() with coindexed scalars [PR93834] (was: [PATCH] PR fortran/93834 - [9/10/11/12 Regression] ICE in trans_caf_is_present, at fortran/trans-intrinsic.c:8469)

2021-09-07 Thread Harald Anlauf via Gcc-patches
Hi Tobias, I think I can follow now what you are thinking, and I also had some thoughts about what you be done in principle. I was struggling the way I did because of: (1) Intel rejects the code in the PR. For my previous patch, % ifort coarray_allocated.f90 -coarray coarray_allocated.f90(8):

[PATCH] PR fortran/82314 - ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:6972

2021-09-07 Thread Harald Anlauf via Gcc-patches
When adding the initializer for an array, we need to make sure that array bounds are properly simplified if that array is a PARAMETER. Otherwise the generated initializer could be wrong and screw up subsequent simplifications, see PR. The minimal solution is to attempt simplification of array

*PING* [PATCH] PR fortran/101327 - ICE in find_array_element, at fortran/expr.c:1355

2021-09-06 Thread Harald Anlauf via Gcc-patches
PING. > Gesendet: Montag, 30. August 2021 um 23:40 Uhr > Von: "Harald Anlauf" > An: "fortran" , "gcc-patches" > Betreff: [PATCH] PR fortran/101327 - ICE in find_array_element, at > fortran/expr.c:1355 > > There was an issue when trying to use an element from an array constructor > which was a

[PATCH, committed] PR fortran/102366] [10/11/12 Regression] large arrays no longer become static

2021-09-17 Thread Harald Anlauf via Gcc-patches
The attempt to fix a misleading warning lead to a regression that prevented putting large variables in the main into static storage. So instead of preventing the move, we now disable the useless warning for variables in the main. Regtested on x86_64-pc-linux-gnu. The patch was ok'ed in the PR

[PATCH, committed] PR fortran/102311 - fix ICE during error recovery checking entry characteristics

2021-09-14 Thread Harald Anlauf via Gcc-patches
Committed as obvious as r12-3533. The fix to PR87737 did work for the given testcase, but could lead to a bad internal compiler state for a variation of the testcase. (Found by Gerhard...) The solution was to not return too early after emitting the error message but going through a 'cleanup'

[PATCH] PR fortran/100949 - [9/10/11/12 Regression] ICE in gfc_conv_expr_present, at fortran/trans-expr.c:1975

2021-07-13 Thread Harald Anlauf via Gcc-patches
Hello world, we rather shouldn't consider a presence check for a non-dummy variable. Regtested on x86_64-pc-linux-gnu. OK for all affected branches? Thanks, Harald Fortran - ICE in gfc_conv_expr_present while initializing a non-dummy class variable gcc/fortran/ChangeLog: PR

Re: [PATCH] PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514

2021-08-03 Thread Harald Anlauf via Gcc-patches
Here's now my third attempt to fix this PR, taking into account the comments by Tobias and Bernhard. > > On 10.06.21 20:52, Harald Anlauf via Fortran wrote: > > > +static bool > > > +substring_has_constant_len (gfc_expr *e) > > > +{ > > > + ptrdiff_t istart, iend; > > > + size_t length; > > > +

[PATCH, part2] PR fortran/98411 [10/11/12 Regression] Pointless: Array larger than ‘-fmax-stack-var-size=’, ...

2021-08-04 Thread Harald Anlauf via Gcc-patches
Dear all, here's the second part that should fix this regression for good. The patch also adjusts the warning message to make it easier to understand, using the suggestion by Tobias (see PR). Since F2018 in principle makes RECURSIVE the default, which might conflict with the purpose of the

[PATCH] PR fortran/68568 - ICE with automatic character object and save, in combination with some options

2021-08-06 Thread Harald Anlauf via Gcc-patches
Dear Fortranners, I intend to commit the following pretty obvious fix within the next 24 hours unless there are objections. Regtested on x86_64-pc-linux-gnu. Thanks, Harald Fortran: ICE with automatic character object, save, and various options gcc/fortran/ChangeLog: PR fortran/68568

*PING* [PATCH, part2] PR fortran/98411 [10/11/12 Regression] Pointless: Array larger than ‘-fmax-stack-var-size=’, ...

2021-08-11 Thread Harald Anlauf via Gcc-patches
*Ping* > Gesendet: Mittwoch, 04. August 2021 um 23:09 Uhr > Von: "Harald Anlauf" > An: "fortran" , "gcc-patches" > Betreff: [PATCH, part2] PR fortran/98411 [10/11/12 Regression] Pointless: > Array larger than ‘-fmax-stack-var-size=’, ... > > Dear all, > > here's the second part that should

[PATCH] PR fortran/99351 - ICE in gfc_finish_var_decl, at fortran/trans-decl.c:695

2021-08-11 Thread Harald Anlauf via Gcc-patches
Dear all, the checks for the STAT= and ERRMSG= arguments to the coarray SYNC statements did not properly handle several cases, such as named constants (parameters). While fixing this, I adjusted the code similarly to what was recently done for (DE)ALLOCATE. We now also accept function references

*PING* Re: [PATCH] PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514

2021-08-11 Thread Harald Anlauf via Gcc-patches
*Ping* > Gesendet: Dienstag, 03. August 2021 um 23:17 Uhr > Von: "Harald Anlauf" > An: "Harald Anlauf" > Cc: "Tobias Burnus" , "Bernhard Reutner-Fischer" > , "Harald Anlauf via Gcc-patches" > , "fortran" > Be

[PATCH] PR fortran/102458 - ICE tree check: expected array_type, have pointer_type in gfc_conv_array_initializer, at fortran/trans-array.c:6136

2021-09-23 Thread Harald Anlauf via Gcc-patches
Dear Fortranners, we missed certain intrinsics as being disallowed in constant expressions, which lead to an ICE when these intrinsics were used in a specification expression with an initializer. The intrinsics in question are listed in F2018:10.1.2. As discussed in the PR, Steve recommended to

Re: [PATCH] PR fortran/65454 - accept both old and new-style relational operators

2021-10-09 Thread Harald Anlauf via Gcc-patches
Hi Jerry, > Gesendet: Samstag, 09. Oktober 2021 um 00:28 Uhr > Looks all good Harald, OK and thanks for the support! Thanks for the quick review! Harald

*PING* [PATCH] PR fortran/99348, 102521 - ICEs when initializing DT parameter arrays from scalar

2021-10-09 Thread Harald Anlauf via Gcc-patches
*Ping* Am 03.10.21 um 21:20 schrieb Harald Anlauf via Fortran: Dear Fortranners, when initializing parameter arrays from scalars, we did handle only the case init->expr_type == EXPR_CONSTANT, which misses the case of derived types. As a consequence the constructor for the r.h.s. was not set

Re: [Patch] Fortran: Various CLASS + assumed-rank fixed [PR102541]

2021-10-11 Thread Harald Anlauf via Gcc-patches
Hi Tobias, Am 01.10.21 um 02:43 schrieb Tobias Burnus: Hi all, this patch fixes a bunch of issues with CLASS.  * * * besides my previous minor remarks I do not have further comments. I played around a little but did not find any (new) obstacles. OK for mainline? OK from my side.

Re: [Patch] Fortran: Various CLASS + assumed-rank fixed [PR102541]

2021-10-10 Thread Harald Anlauf via Gcc-patches
Hi Tobias, just some random remarks from initially browsing your patch. - leftover from debugging? diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 1c24556c299..8a82e55d1f9 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -1,3 +1,4 @@ +#pragma GCC

[PATCH] PR fortran/102685 - ICE in output_constructor_regular_field, at varasm.c:5514

2021-10-14 Thread Harald Anlauf via Gcc-patches
Dear Fortranners, the attached patch adds a check for the shape of arrays in derived type constructors. This brings it in line with other major brands. Example: type t integer :: a(1) end type type(t), parameter :: y(2) = t([1,2]) end This was silently accepted before, but now

Re: [PATCH] PR fortran/102685 - ICE in output_constructor_regular_field, at varasm.c:5514

2021-10-15 Thread Harald Anlauf via Gcc-patches
Hi Tobias, all, > > In developing the patch I encountered a difficulty with testcase > > dec_structure_6.f90, which uses a DEC extension, namelist "old-style > > CLIST initializers in STRUCTURE". I could not figure out how to > > determine the shape of the initializer; it seemed to be always

[PATCH] PR fortran/65454 - accept both old and new-style relational operators

2021-10-08 Thread Harald Anlauf via Gcc-patches
Dear Fortranners, F2018:10.1.5.5.1(2) requires the same interpretation of old and new-style relational operators. We internally distinguish between old and new style, but try to map appropriately when used. This mapping was missing when reading a module via USE module, ONLY: OPERATOR(op)

[PATCH] PR fortran/102716 - ICE in gfc_validate_kind(): Got bad kind

2021-10-13 Thread Harald Anlauf via Gcc-patches
Dear Fortranners, another simple and obvious fix: we need to reorder the argument checks to the SHAPE intrinsic so that invalid KIND arguments can be detected. Regtested on x86_64-pc-linux-gnu. OK for mainline? As I consider this a safe fix, I'd like to backport to suitable branches. Thanks,

[PATCH] PR fortran/102717 - ICE in gfc_simplify_reshape, at fortran/simplify.c:6843

2021-10-13 Thread Harald Anlauf via Gcc-patches
Dear Fortranners, when simplifying RESHAPE we hit a gcc_assert for negative entries in the SHAPE array. Obvious solution: replace gcc_assert by an error message. Regtested on x86_64-pc-linux-gnu. OK for mainline? As this is a safe fix, I'd like to backport to suitable branches. Thanks,

Re: [Patch] [v3] Fortran: Fix Bind(C) Array-Descriptor Conversion (Move to Front-End Code)

2021-10-13 Thread Harald Anlauf via Gcc-patches
Hi Tobias, Am 13.10.21 um 18:01 schrieb Tobias Burnus: Dear all, a minor update [→ v3]. this has become an impressive work. I searched for XFAIL in Sandra's c-interop/ and found two remaining true** xfails, now fixed: - gfortran.dg/c-interop/typecodes-scalar-basic.f90   The conversion of

Re: [Patch] Fortran: Fix assumed-size to assumed-rank passing [PR94070]

2021-09-28 Thread Harald Anlauf via Gcc-patches
Hi Tobias, let me first reach for my brown bag... > Otherwise, the quote from F2018 of my previous email applies: > > F2018:16.9.109 LBOUND has for "case(i)", i.e. with a 'dim' > argument the following. The case without 'dim' just iterates > through case (i) for each dim. Thus: > > "If DIM is

[PATCH] PR fortran/102520 - [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802

2021-09-28 Thread Harald Anlauf via Gcc-patches
Dear Fortranners, Gerhard's testcase triggers a NULL pointer dereference during the attempt to expand an invalid constructor. The simple and obvious solution is to catch that case. Regtested on x86_64-pc-linux-gnu. OK for all affected branches? Thanks, Harald Fortran: fix error recovery for

Re: [Patch] Fortran: Avoid var initialization in interfaces [PR54753]

2021-09-29 Thread Harald Anlauf via Gcc-patches
Hi Tobias, Am 29.09.21 um 10:53 schrieb Tobias Burnus: Found when looking at F2018:C839 / PR54753. For INTENT(OUT) the dummy variable (might) also be default initialized or deallocated. However, with assumed rank, that causes issues, which C839 prevents. In the current GCC implementation,

[PATCH, part 2] PR 102458 - issues with simplification of SIZE intrinsic applied to automatic arrays

2021-09-29 Thread Harald Anlauf via Gcc-patches
Dear Fortranners, I think I have solved the remaining issue in PR 102458 that prevented the simplification of an expression involving a static initialization and the evaluation of the SIZE of an automatic array which has provable constant size. My previous related query to the ML has thus become

Re: [Patch] Fortran: Fix -Wno-missing-include-dirs handling [PR55534]

2021-09-20 Thread Harald Anlauf via Gcc-patches
Hi Tobias, Am 20.09.21 um 22:33 schrieb Tobias Burnus: And v3 – I realized that testcases would be useful. Thus, now with added testcases. :-) I was about to recommend a testcase I prepared when your revised patch arrived. Will not bother you with it, as you seem to provide really good

Re: [Patch] Fortran: Improve -Wmissing-include-dirs warnings [PR55534]

2021-09-22 Thread Harald Anlauf via Gcc-patches
Hi Tobias, Am 21.09.21 um 21:22 schrieb Tobias Burnus: While the previous patch fixed -Wno-missing-include-dirs and sorted out some inconsistencies with libcpp warnings, it had two issues: * Some superfluous warnings were printed, e.g. for     gfortran nonexisting/file.f90   there was a

  1   2   3   4   5   6   >