[Bug rtl-optimization/109187] New: [13 Regression] ICE: qsort checking failed: qsort comparator non-negative on sorted output: 1736258160 at -O2

2023-03-18 Thread zsojka at seznam dot cz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109187

Bug ID: 109187
   Summary: [13 Regression] ICE: qsort checking failed: qsort
comparator non-negative on sorted output: 1736258160
at -O2
   Product: gcc
   Version: 13.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zsojka at seznam dot cz
  Target Milestone: ---
  Host: x86_64-pc-linux-gnu
Target: aarch64-unknown-linux-gnu

Created attachment 54703
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54703=edit
reduced testcase

Compiler output:
$ aarch64-unknown-linux-gnu-gcc testcase.c -O2
testcase.c: In function 'foo':
testcase.c:15:1: error: qsort comparator non-negative on sorted output:
1736258160
   15 | }
  | ^
during RTL pass: sched1
testcase.c:15:1: internal compiler error: qsort checking failed
0xad2af3 qsort_chk_error
/repo/gcc-trunk/gcc/vec.cc:204
0xad2c3c qsort_chk(void*, unsigned long, unsigned long, int (*)(void const*,
void const*, void*), void*)
/repo/gcc-trunk/gcc/vec.cc:246
0x20ccab5 gcc_qsort(void*, unsigned long, unsigned long, int (*)(void const*,
void const*))
/repo/gcc-trunk/gcc/sort.cc:272
0x1ec3882 ready_sort_real
/repo/gcc-trunk/gcc/haifa-sched.cc:3095
0x1ecc05c ready_sort
/repo/gcc-trunk/gcc/haifa-sched.cc:3111
0x1ecc05c schedule_block(basic_block_def**, void*)
/repo/gcc-trunk/gcc/haifa-sched.cc:6718
0x1125b1a schedule_region
/repo/gcc-trunk/gcc/sched-rgn.cc:3200
0x1125b1a schedule_insns()
/repo/gcc-trunk/gcc/sched-rgn.cc:3527
0x1125dec schedule_insns()
/repo/gcc-trunk/gcc/sched-rgn.cc:3513
0x1125dec rest_of_handle_sched
/repo/gcc-trunk/gcc/sched-rgn.cc:3731
0x1125dec execute
/repo/gcc-trunk/gcc/sched-rgn.cc:3841
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug middle-end/108685] [10/11/12 Regression] ICE in verify_loop_structure, at cfgloop.cc:1748 since r13-2388-ga651e6d59188da

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108685

--- Comment #9 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:d1b61495f60141dd9c8cad4a699d5adcecc56b85

commit r12-9291-gd1b61495f60141dd9c8cad4a699d5adcecc56b85
Author: Jakub Jelinek 
Date:   Fri Mar 17 08:46:28 2023 +0100

openmp: Fix up handling of doacross loops with noreturn body in loops
[PR108685]

The following patch fixes an ICE with doacross loops which have a single
entry
no exit body, at least one of the ordered > collapse loops isn't guaranteed
to
have at least one iteration and the whole doacross loop is inside some
other loop.
The OpenMP constructs aren't represented by struct loop until the omp
expansions,
so for a normal doacross loop which doesn't have a noreturn body the
entry_bb
with the GOMP_FOR statement and the first bb of the body typically have the
same loop_father, and if the doacross loop isn't inside of some other loop
and the body is noreturn as well, both are part of loop 0.  The problematic
case is when the entry_bb is inside of some deeper loop, but the body,
because
it falls through into EXIT, has loop 0 as loop_father.  l0_bb is created by
splitting the entry_bb fallthru edge into l1_bb, and because the two basic
blocks
have different loop_father, a common loop is found for those (which is loop
0).
Now, if the doacross loop has collapse == ordered or all the ordered >
collapse
loops are guaranteed to iterate at least once, all is still fine, because
all
enter the l1_bb (body), which doesn't return and so doesn't loop further
either.
But, if one of those loops could loop 0 times, the user written body
wouldn't be
reached at all, so unlike the expectations the whole construct actually
wouldn't
be noreturn if entry_bb is encountered and decides to handle at least one
iteration.

In this case, we need to fix up, move the l0_bb into the same loop as
entry_bb
(initially) and for the extra added loops put them as children of that same
loop, rather than of loop 0.

2023-03-17  Jakub Jelinek  

PR middle-end/108685
* omp-expand.cc (expand_omp_for_ordered_loops): Add L0_BB argument,
use its loop_father rather than BODY_BB's loop_father.
(expand_omp_for_generic): Adjust expand_omp_for_ordered_loops
caller.
If broken_loop with ordered > collapse and at least one of those
extra loops aren't guaranteed to have at least one iteration,
change
l0_bb's loop_father to entry_bb's loop_father.  Set cont_bb's
loop_father to l0_bb's loop_father rather than l1_bb's.

* c-c++-common/gomp/doacross-8.c: New test.

(cherry picked from commit 713fa5db8ceb4ba8783a0d690ceb4c07f2ff03d0)

[Bug c++/109096] __has_unique_object_representations does not account for unnamed bitfield

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109096

--- Comment #6 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:9dc438900f77cf47e4e89522bc68c85b289dd52a

commit r12-9290-g9dc438900f77cf47e4e89522bc68c85b289dd52a
Author: Jakub Jelinek 
Date:   Tue Mar 14 16:17:32 2023 +0100

c++: Treat unnamed bitfields as padding for
__has_unique_object_representations [PR109096]

As reported in the PR, for __has_unique_object_representations we
were treating unnamed bitfields as named ones, which is wrong, they
are actually padding.

THe following patch fixes that.

2023-03-14  Jakub Jelinek  

PR c++/109096
* tree.cc (record_has_unique_obj_representations): Ignore unnamed
bitfields.

* g++.dg/cpp1z/has-unique-obj-representations3.C: New test.

(cherry picked from commit c35cf160a0ed81570cff6600dba465cf95fa80fa)

[Bug c++/107558] [10/11/12 Regression] ICE in fld_incomplete_type_of with -fmerge-all-constants and openmp and LTO since r11-16-ga2f32550a085984f

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107558

--- Comment #5 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:2744af7ac0a6e46551556cdf5d6df2486e79ef3f

commit r12-9289-g2744af7ac0a6e46551556cdf5d6df2486e79ef3f
Author: Jakub Jelinek 
Date:   Fri Mar 10 20:38:13 2023 +0100

c++: Don't clear TREE_READONLY for -fmerge-all-constants for non-aggregates
[PR107558]

The following testcase ICEs, because OpenMP lowering for shared clause
on l variable with REFERENCE_TYPE creates POINTER_TYPE to REFERENCE_TYPE.
The reason is that the automatic variable has non-trivial construction
(reference to a lambda) and -fmerge-all-constants is on and so
TREE_READONLY
isn't set - omp-low will handle automatic TREE_READONLY vars in shared
specially and only copy to the construct and not back, while !TREE_READONLY
are assumed to be changeable.
The PR91529 change rationale was that the gimplification can change
some non-addressable automatic variables to TREE_STATIC with
-fmerge-all-constants and therefore TREE_READONLY on them is undesirable.
But, the gimplifier does that only for aggregate variables:
  switch (TREE_CODE (type))
{
case RECORD_TYPE:
case UNION_TYPE:
case QUAL_UNION_TYPE:
case ARRAY_TYPE:
and not for anything else.  So, I think clearing TREE_READONLY for
automatic integral or reference or pointer etc. vars for
-fmerge-all-constants only is unnecessary.

2023-03-10  Jakub Jelinek  

PR c++/107558
* decl.cc (cp_finish_decl): Don't clear TREE_READONLY on
automatic non-aggregate variables just because of
-fmerge-all-constants.

* g++.dg/gomp/pr107558.C: New test.

(cherry picked from commit 60b6f5c0a334db3f8f6dffaf0b9aab42fd5c54a2)

[Bug c/108079] [10/11/12 Regression] -Wunused-variable gives misleading duplicate warning for unused static local variable

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108079

--- Comment #6 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:e4984838f6af868399ef9d885377199c38907ee1

commit r12-9287-ge4984838f6af868399ef9d885377199c38907ee1
Author: Jakub Jelinek 
Date:   Fri Mar 10 10:10:24 2023 +0100

c, c++, cgraphunit: Prevent duplicated -Wunused-value warnings [PR108079]

On the following testcase, we warn with -Wunused-value twice, once
in the FEs and later on cgraphunit again with slightly different
wording.

The following patch fixes that by registering a warning suppression in the
FEs when we warn and not warning in cgraphunit anymore if that happened.

2023-03-10  Jakub Jelinek  

PR c/108079
gcc/
* cgraphunit.cc (check_global_declaration): Don't warn for unused
variables which have OPT_Wunused_variable warning suppressed.
gcc/c/
* c-decl.cc (pop_scope): Suppress OPT_Wunused_variable warning
after diagnosing it.
gcc/cp/
* decl.cc (poplevel): Suppress OPT_Wunused_variable warning
after diagnosing it.
gcc/testsuite/
* c-c++-common/Wunused-var-18.c: New test.

(cherry picked from commit 2c63cc7268fd5615997989f153e9405d0f5aaa50)

[Bug c/107465] [10/11/12 Regression] Bogus warning: promoted bitwise complement of an unsigned value is always nonzero

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107465

--- Comment #13 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:93aafc14410388875313719a76b92812911a861a

commit r12-9286-g93aafc14410388875313719a76b92812911a861a
Author: Jakub Jelinek 
Date:   Sat Mar 4 10:21:45 2023 +0100

c-family: Incremental fix for -Wsign-compare BIT_NOT_EXPR handling
[PR107465]

There can be too many extensions and seems I didn't get everything right in
the previously posted patch.

The following incremental patch ought to fix that.
The code can deal with quite a few sign/zero extensions at various spots
and it is important to deal with all of them right.
On the argument that contains BIT_NOT_EXPR we have:
MSB bits#4 bits#3 BIT_NOT_EXPR bits#2 bits#1 LSB
where bits#1 is one or more bits (TYPE_PRECISION (TREE_TYPE (arg0))
at the end of the function) we don't know anything about, for the purposes
of this warning it is VARYING that is inverted with BIT_NOT_EXPR to some
other
VARYING bits;
bits#2 is one or more bits (TYPE_PRECISION (TREE_TYPE (op0)) -
TYPE_PRECISION (TREE_TYPE (arg0)) at the end of the function)
which are known to be 0 before the BIT_NOT_EXPR and 1 after it.
bits#3 is zero or more bits from the TYPE_PRECISION (TREE_TYPE (op0))
at the end of function to the TYPE_PRECISION (TREE_TYPE (op0)) at the
end of the function to TYPE_PRECISION (TREE_TYPE (op0)) at the start
of the function, which are either zero extension or sign extension.
And bits#4 is zero or more bits from the TYPE_PRECISION (TREE_TYPE (op0))
at the start of the function to TYPE_PRECISION (result_type), which
again can be zero or sign extension.

Now, vanilla trunk as well as the previously posted patch mishandles the
case where bits#3 are sign extended (as bits#2 are known to be all set,
that means bits#3 are all set too) but bits#4 are zero extended and are
thus all 0.

The patch fixes it by tracking the lowest bit which is known to be clear
above the known to be set bits (if any, otherwise it is precision of
result_type).

2023-03-04  Jakub Jelinek  

PR c/107465
* c-warn.cc (warn_for_sign_compare): Don't warn for unset bits
above innermost zero extension of BIT_NOT_EXPR result.

* c-c++-common/Wsign-compare-2.c (f18): New test.

(cherry picked from commit 3ec9a8728086ad86a2d421e067329f305f40e005)

[Bug target/105554] [10/11/12 Regression] ICE: in emit_block_move_hints, at expr.cc:1829 since r9-5509-g5928bc2ec06dd4e7

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105554

--- Comment #23 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:b2747a4213635352f8315114c5925f178fed0544

commit r12-9293-gb2747a4213635352f8315114c5925f178fed0544
Author: Jakub Jelinek 
Date:   Fri Mar 17 18:59:56 2023 +0100

tree-inline: Fix up multiversioning with vector arguments [PR105554]

The following testcase ICEs, because we call tree_function_versioning from
old_decl which has target attributes not supporting V4DImode and so
DECL_MODE of DECL_ARGUMENTS is BLKmode, while new_decl supports those.
tree_function_versioning initially copies DECL_RESULT and DECL_ARGUMENTS
from old_decl to new_decl, then calls initialize_cfun to create cfun
and only when the cfun is created it can later actually remap_decl
DECL_RESULT and DECL_ARGUMENTS etc.
The problem is that initialize_cfun -> push_struct_function ->
allocate_struct_function calls relayout_decl on DECL_RESULT and
DECL_ARGUMENTS, which clobbers DECL_MODE of old_decl and we then ICE
because
of it.
In particular, allocate_struct_function does:
  if (!abstract_p)
{
  /* Now that we have activated any function-specific attributes
 that might affect layout, particularly vector modes, relayout
 each of the parameters and the result.  */
  relayout_decl (result);
  for (tree parm = DECL_ARGUMENTS (fndecl); parm;
   parm = DECL_CHAIN (parm))
relayout_decl (parm);

  /* Similarly relayout the function decl.  */
  targetm.target_option.relayout_function (fndecl);
}

  if (!abstract_p && aggregate_value_p (result, fndecl))
{
 #ifdef PCC_STATIC_STRUCT_RETURN
  cfun->returns_pcc_struct = 1;
 #endif
  cfun->returns_struct = 1;
}
Now, in the case of tree_function_versioning, I believe all that we need
from these is possibly the
targetm.target_option.relayout_function (fndecl);
call (arm only), we will remap DECL_RESULT and DECL_ARGUMENTS later on
and copy_decl_for_dup_finish in that case will handle all we need:
  /* For vector typed decls make sure to update DECL_MODE according
 to the new function context.  */
  if (VECTOR_TYPE_P (TREE_TYPE (copy)))
SET_DECL_MODE (copy, TYPE_MODE (TREE_TYPE (copy)));
We don't need the cfun->returns_*struct either, because we override it
in initialize_cfun a few lines later:
  /* Copy items we preserve during cloning.  */
...
  cfun->returns_struct = src_cfun->returns_struct;
  cfun->returns_pcc_struct = src_cfun->returns_pcc_struct;

So, to avoid the clobbering of DECL_RESULT/DECL_ARGUMENTS of old_decl,
the following patch arranges allocate_struct_function to be called with
abstract_p true and calls targetm.target_option.relayout_function (fndecl);
by hand.

The removal of DECL_RESULT/DECL_ARGUMENTS copying at the start of
initialize_cfun is removed because the only caller -
tree_function_versioning, does that unconditionally before.

2023-03-17  Jakub Jelinek  

PR target/105554
* function.h (push_struct_function): Add ABSTRACT_P argument
defaulted
to false.
* function.cc (push_struct_function): Add ABSTRACT_P argument, pass
it
to allocate_struct_function instead of false.
* tree-inline.cc (initialize_cfun): Don't copy DECL_ARGUMENTS
nor DECL_RESULT here.  Pass true as ABSTRACT_P to
push_struct_function.  Call targetm.target_option.relayout_function
after it.
(tree_function_versioning): Formatting fix.

* gcc.target/i386/pr105554.c: New test.

(cherry picked from commit 24c06560a7fa39049911eeb8777325d112e0deb9)

[Bug c++/109039] [12 Regression] Miscompilation with no_unique_address and bitfields

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109039

--- Comment #7 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:794e4f69cf2434c82388820f78c0e9e86fdd677b

commit r12-9288-g794e4f69cf2434c82388820f78c0e9e86fdd677b
Author: Jakub Jelinek 
Date:   Fri Mar 10 20:36:33 2023 +0100

c++, abi: Fix up class layout with bitfields [PR109039]

The following testcase FAILs, because starting with r12-6028
the S class has only 2 bytes, not enough to hold one 7-bit bitfield, one
8-bit
bitfield and one 8-bit char field.

The reason is that when end_of_class attempts to compute dsize, it simply
adds byte_position of the field and DECL_SIZE_UNIT (and uses maximum from
those offsets).
The problematic bit-field in question has bit_position 7, byte_position 0,
DECL_SIZE 8 and DECL_SIZE_UNIT 1.  So, byte_position + DECL_SIZE_UNIT is
1, even when the bitfield only has a single bit in the first byte and 7
further bits in the second byte, so per the Itanium ABI it should be 2:
"In either case, update dsize(C) to include the last byte
containing (part of) the bit-field, and update sizeof(C) to
max(sizeof(C),dsize(C))."

The following patch fixes it by computing bitsize of the end and using
CEIL_DIV_EXPR division to round it to next byte boundary and convert
from bits to bytes.

While this is an ABI change, classes with such incorrect layout couldn't
have worked properly, so I doubt anybody is actually running it often
in the wild.  Thus I think adding some ABI warning for it is unnecessary.

2023-03-10  Jakub Jelinek  

PR c++/109039
* class.cc (end_of_class): For bit-fields, instead of computing
offset as sum of byte_position (field) and DECL_SIZE_UNIT (field),
compute it as sum of bit_position (field) and DECL_SIZE (field)
divided by BITS_PER_UNIT rounded up.

* g++.dg/abi/no_unique_address7.C: New test.

(cherry picked from commit 991f9eb2da3a268b7b08346761fa0078ab55f506)

[Bug testsuite/108973] [10/11/12 Regression] Sufficiently narrow terminal window causes selftest failure

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108973

--- Comment #8 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:643985d91512fb8762623034d36d3f48a8b1c282

commit r12-9284-g643985d91512fb8762623034d36d3f48a8b1c282
Author: Jakub Jelinek 
Date:   Sat Mar 4 09:48:17 2023 +0100

diagnostics: Fix up selftests with $COLUMNS < 42 [PR108973]

As mentioned in the PR, GCC's diagnostics self-tests fail if $COLUMNS < 42.
Guarding each self-test with if (get_terminal_width () > 41) or similar
would be a maintainance nightmare (PR has a patch to do so without
reformatting to make it work for $COLUMNS in [30, 41] inclusive, but
I'm afraid going down to $COLUMNS 1 would mean marking everything).
Furthermore, the self-tests don't really emit stuff to the terminal,
but into a buffer, so using get_terminal_width () for it seems
inappropriate.  The following patch makes sure test_diagnostic_context
constructor uses exactly 80 columns wide caret max width, of course
some tests override it already if they want to test for behavior in
narrower
cases.

2023-03-04  Jakub Jelinek  

PR testsuite/108973
* selftest-diagnostic.cc
(test_diagnostic_context::test_diagnostic_context): Set
caret_max_width to 80.

(cherry picked from commit 739e7ebb3d378ece25d64b39baae47c584253498)

[Bug c/109151] UBsan misses a divide-by-zero

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109151

--- Comment #5 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:ffb22189be90216e6af386aaef8b76d2dcd05b84

commit r12-9292-gffb22189be90216e6af386aaef8b76d2dcd05b84
Author: Jakub Jelinek 
Date:   Fri Mar 17 16:10:14 2023 +0100

c, ubsan: Instrument even shortened divisions [PR109151]

On the following testcase, the C FE decides to shorten the division because
it has a guarantee that INT_MIN / -1 division won't be encountered, the
first operand is widened from narrower unsigned and/or the second operand
is
a constant other than all ones (in this case both are true).
The problem is that the narrower type in this case is _Bool and
ubsan_instrument_division only instruments it if op0's type is INTEGER_TYPE
or REAL_TYPE.  Strangely this doesn't happen in C++ FE.
Anyway, we only shorten divisions if the INT_MIN / -1 case is impossible,
so I think we should be fine even with -fstrict-enums in C++ in case it
shortened to ENUMERAL_TYPEs.

The following patch just instruments those on the ubsan_instrument_division
side.  Perhaps only the first hunk and testcase might be needed because
we shouldn't shorten if the other case could be triggered.

2023-03-17  Jakub Jelinek  

PR c/109151
* c-ubsan.cc (ubsan_instrument_division): Handle all scalar
integral
types rather than just INTEGER_TYPE.

* c-c++-common/ubsan/div-by-zero-8.c: New test.

(cherry picked from commit 103d423f6ce72ccb03d55b7b1dfa2dabd5854371)

[Bug c/108986] [11/12 Regression] Incorrect warning for [static] array parameter

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108986

--- Comment #7 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:d0e59b5e849258ab00c82ccab37c5e8246a41c6a

commit r12-9283-gd0e59b5e849258ab00c82ccab37c5e8246a41c6a
Author: Jakub Jelinek 
Date:   Fri Mar 3 16:11:11 2023 +0100

waccess: Fix two -Wnonnull warning issues [PR108986]

The following patch fixes 2 issues with the -Wnonnull warning.

One, fixed by the second hunk, is that the warning wording is bogus
since r11-3305, instead of printing
warning: argument 1 to âint[static 7]â is null where non-null expected
[-Wnonnull]
it prints
warning: argument 1 to âint[static 28]â is null where non-null expected
[-Wnonnull]
access_size is measured in bytes, so obviously will be correct as array
number of elements only if it is 1 byte element array.
In the function, access_nelts is either constant (if sizidx == -1) or
when the array size is determined by some other parameter, I believe a
value
passed to that argument.
Later on we query the range of it:
  if (get_size_range (m_ptr_qry.rvals, access_nelts, stmt, sizrng, 1))
which I bet must just return accesS_nelts in sizrng[0] and [1] if it is
constant.  access_size is later computed as:
  tree access_size = NULL_TREE;
  if (tree_int_cst_sgn (sizrng[0]) >= 0)
{
  if (COMPLETE_TYPE_P (argtype))
{
...
wide_int minsize = wi::to_wide (sizrng[0], prec);
minsize *= wi::to_wide (argsize, prec);
access_size = wide_int_to_tree (sizetype, minsize);
  }
}
  else
access_size = access_nelts;
}
and immediately after this the code does:
  if (integer_zerop (ptr))
{
  if (sizidx >= 0 && tree_int_cst_sgn (sizrng[0]) > 0)
{
some other warning wording
}
  else if (access_size && access.second.static_p)
{
this spot
}
}
So, because argtype is complete, access_size has been multiplied by
argsize, but in case of this exact warning ("this spot" above)
I believe access_nelts must be really constant, otherwise
"some other warning wording" would handle it.  So, I think access_nelts
is exactly what we want to print there.

The other problem is that since the introduction of -Wdangling-pointer
in r12-6606, the pass has early and late instances and while lots of
stuff in the pass is guarded on being done in the late pass only,
this particular function is not, furthermore it is emitting two different
warnings in a loop and already messes up with stuff like clearing
warning suppression for one of the warning (ugh!).  The end effect is
that we warn twice about the same problem, once in the early and once in
the late pass.  Now, e.g. with -O2 -Wall we warn just once, during the
early pass, as it is then optimized away, so I think just making this
late warning only wouldn't be best.  This patch instead returns early
if either of the warnings is suppressed on the call stmt already.
I think if one of the passes warned on it already (even if say on some
other
argument), then warning again (even on some other argument) is unnecessary,
if both problems are visible in the same pass we'll still warn about both.

2023-03-03  Jakub Jelinek  

PR c/108986
* gimple-ssa-warn-access.cc
(pass_waccess::maybe_check_access_sizes):
Return immediately if OPT_Wnonnull or OPT_Wstringop_overflow_ is
suppressed on stmt.  For [static %E] warning, print access_nelts
rather than access_size.  Fix up comment wording.

* gcc.dg/Wnonnull-8.c: New test.

(cherry picked from commit 1b0e3f8ca369f63d3e1a8e1c268d93530035503a)

[Bug target/18247] [4.0 regression] ada runtime bootstrap failure on powerpc-linux

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18247

--- Comment #3 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:7d685cb42c1568f6ac017ea2503b366ec474ce0e

commit r12-9282-g7d685cb42c1568f6ac017ea2503b366ec474ce0e
Author: Jakub Jelinek 
Date:   Fri Mar 3 00:40:13 2023 +0100

libquadmath: Assorted libquadmath strtoflt128 fixes [PR87204, PR94756]

This patch cherry-pickx 8 commits from glibc which fix various strtod_l
bugs.

2023-03-03  niXman  
Jakub Jelinek  

PR libquadmath/87204
PR libquadmath/94756
* strtod/strtod_l.c (round_and_return): Cherry-pick glibc
9310c284ae9 BZ #16151, 4406c41c1d6 BZ #16965 and fcd6b5ac36a
BZ #23279 fixes.
(STRTOF_INTERNAL): Cherry-pick glibc b0debe14fcf BZ #23007,
5556d30caee BZ #18247, 09555b9721d and c6aac3bf366 BZ #26137 and
d84f25c7d87 fixes.

(cherry picked from commit df63f4162c78ef799d4ea9dec3443d5e9c51e5aa)

[Bug c++/16965] [3.4/4.0 regression] Confusing mismatch in error messages

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16965

--- Comment #6 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:7d685cb42c1568f6ac017ea2503b366ec474ce0e

commit r12-9282-g7d685cb42c1568f6ac017ea2503b366ec474ce0e
Author: Jakub Jelinek 
Date:   Fri Mar 3 00:40:13 2023 +0100

libquadmath: Assorted libquadmath strtoflt128 fixes [PR87204, PR94756]

This patch cherry-pickx 8 commits from glibc which fix various strtod_l
bugs.

2023-03-03  niXman  
Jakub Jelinek  

PR libquadmath/87204
PR libquadmath/94756
* strtod/strtod_l.c (round_and_return): Cherry-pick glibc
9310c284ae9 BZ #16151, 4406c41c1d6 BZ #16965 and fcd6b5ac36a
BZ #23279 fixes.
(STRTOF_INTERNAL): Cherry-pick glibc b0debe14fcf BZ #23007,
5556d30caee BZ #18247, 09555b9721d and c6aac3bf366 BZ #26137 and
d84f25c7d87 fixes.

(cherry picked from commit df63f4162c78ef799d4ea9dec3443d5e9c51e5aa)

[Bug target/26137] Cannot connect to target board h8 using GDB

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26137

--- Comment #3 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:7d685cb42c1568f6ac017ea2503b366ec474ce0e

commit r12-9282-g7d685cb42c1568f6ac017ea2503b366ec474ce0e
Author: Jakub Jelinek 
Date:   Fri Mar 3 00:40:13 2023 +0100

libquadmath: Assorted libquadmath strtoflt128 fixes [PR87204, PR94756]

This patch cherry-pickx 8 commits from glibc which fix various strtod_l
bugs.

2023-03-03  niXman  
Jakub Jelinek  

PR libquadmath/87204
PR libquadmath/94756
* strtod/strtod_l.c (round_and_return): Cherry-pick glibc
9310c284ae9 BZ #16151, 4406c41c1d6 BZ #16965 and fcd6b5ac36a
BZ #23279 fixes.
(STRTOF_INTERNAL): Cherry-pick glibc b0debe14fcf BZ #23007,
5556d30caee BZ #18247, 09555b9721d and c6aac3bf366 BZ #26137 and
d84f25c7d87 fixes.

(cherry picked from commit df63f4162c78ef799d4ea9dec3443d5e9c51e5aa)

[Bug c/107465] [10/11/12 Regression] Bogus warning: promoted bitwise complement of an unsigned value is always nonzero

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107465

--- Comment #12 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:13d4c6e52003e7451f6e8bab4fd0a292089fbee2

commit r12-9285-g13d4c6e52003e7451f6e8bab4fd0a292089fbee2
Author: Jakub Jelinek 
Date:   Sat Mar 4 10:18:37 2023 +0100

c-family: Fix up -Wsign-compare BIT_NOT_EXPR handling [PR107465]

The following patch fixes multiple bugs in warn_for_sign_compare related to
the BIT_NOT_EXPR related warnings.
My understanding is that what those 3 warnings are meant to warn (since
1995
apparently) is the case where we have BIT_NOT_EXPR of a zero-extended
value, so in result_type the value is something like:
0b (e.g. ~ of a 8->16 bit zero extension)
0b (e.g. ~ of a 8->16 bit zero extension
then zero extended to 32 bits)
0b (e.g. ~ of a 8->16 bit zero extension
then sign extended to 32 bits)
and the intention of the warning is to warn when this is compared against
something that has some 0 bits at the place where the above has guaranteed
1 bits, either ensured through comparison against constant where we know
the bits exactly, or through zero extension from some narrower type where
again we know at least some upper bits are zero extended.
The bugs in the warning code are:
1) misunderstanding of the {,c_common_}get_narrower APIs - the unsignedp
   it sets is only meaningful if the function actually returns something
   narrower (in that case it says whether the narrower value is then
   sign (0) or zero (1) extended to the originally passed value.
   Though op0 or op1 at this point might be already narrower than
   result_type, and if the function doesn't return anything narrower,
   it all depends on whether the passed in op{0,1} had TYPE_UNSIGNED
   type or not
2) the code didn't check at all whether the BIT_NOT_EXPR operand
   was actually zero extended (i.e. that it was narrower and unsignedp
   was set to 1 for it), all it did is check that unsignedp from the
   call was 1.  But that isn't well defined thing, if the argument
   is returned as is, the function sets unsignedp to 0, but if there
   is e.g. a useless cast to the same or compatible type in between,
   it can return 1 if the cast is unsigned; now, if BIT_NOT_EXPR
   operand is not zero extended, we know nothing at all about any bits
   in the operand containing BIT_NOT_EXPR, so there is nothing to warn
   about
3) the code was actually testing both operands after calling
   c_common_get_narrower on them and on the one with BIT_NOT_EXPR
   again for constants; I think that is just wrong in case the BIT_NOT_EXPR
   operand wouldn't be fully folded, the warning makes sense only if the
   other operand not having BIT_NOT_EXPR in it is constant
4) as can be seen from the above bit pattern examples, the upper bits above
   (in the patch arg0) aren't always all 1s, there could be some zero
extension
   above it and from it one would have 0s, so that needs to be taken into
   account for the choice which constant bits to test for being always set
   otherwise warning is emitted, or for the zero extension guaranteed zero
   bits
5) the patch also simplifies the handling, we only do it if one but not
   both operands are BIT_NOT_EXPR after first {,c_common_}get_narrower,
   so we can just use std::swap to ensure it is the first one
6) the code compared bits against HOST_BITS_PER_LONG, which made sense
   back in 1995 when the values were stored into long, but now that they
   are HOST_WIDE_INT should test HOST_BITS_PER_WIDE_INT (or we could
rewrite
   the stuff to wide_int, not done in the patch)

2023-03-04  Jakub Jelinek  

PR c/107465
* c-warn.cc (warn_for_sign_compare): If c_common_get_narrower
doesn't return a narrower result, use TYPE_UNSIGNED to set
unsignedp0
and unsignedp1.  For the one BIT_NOT_EXPR case vs. one without,
only check for constant in the non-BIT_NOT_EXPR operand, use
std::swap
to simplify the code, only warn if BIT_NOT_EXPR operand is extended
from narrower unsigned, fix up computation of mask for the constant
cases and for unsigned other operand case handle differently
BIT_NOT_EXPR result being sign vs. zero extended.

* c-c++-common/Wsign-compare-2.c: New test.
* c-c++-common/pr107465.c: New test.

(cherry picked from commit daaf74a714c41c8dbaf9954bcc58462c63062b4f)

[Bug libquadmath/94756] strtoflt128 assigns some subnormals incorrectly on MS Windows

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94756

--- Comment #19 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:7d685cb42c1568f6ac017ea2503b366ec474ce0e

commit r12-9282-g7d685cb42c1568f6ac017ea2503b366ec474ce0e
Author: Jakub Jelinek 
Date:   Fri Mar 3 00:40:13 2023 +0100

libquadmath: Assorted libquadmath strtoflt128 fixes [PR87204, PR94756]

This patch cherry-pickx 8 commits from glibc which fix various strtod_l
bugs.

2023-03-03  niXman  
Jakub Jelinek  

PR libquadmath/87204
PR libquadmath/94756
* strtod/strtod_l.c (round_and_return): Cherry-pick glibc
9310c284ae9 BZ #16151, 4406c41c1d6 BZ #16965 and fcd6b5ac36a
BZ #23279 fixes.
(STRTOF_INTERNAL): Cherry-pick glibc b0debe14fcf BZ #23007,
5556d30caee BZ #18247, 09555b9721d and c6aac3bf366 BZ #26137 and
d84f25c7d87 fixes.

(cherry picked from commit df63f4162c78ef799d4ea9dec3443d5e9c51e5aa)

[Bug c++/108934] [12 Regression] bit_cast'ing to long double errors out with "the argument cannot be interpreted" since gcc-12

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108934

--- Comment #9 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:726682897d877afacb8164130cbbc715f8b44784

commit r12-9280-g726682897d877afacb8164130cbbc715f8b44784
Author: Jakub Jelinek 
Date:   Thu Mar 2 09:27:40 2023 +0100

fold-const: Ignore padding bits in native_interpret_expr REAL_CST reverse
verification [PR108934]

In the following testcase we try to std::bit_cast a (pair of) integral
value(s) which has some non-zero bits in the place of x86 long double
(for 64-bit 16 byte type with 10 bytes actually loaded/stored by hw,
for 32-bit 12 byte) and starting with my PR104522 change we reject that
as native_interpret_expr fails on it.  The PR104522 change extends what
has been done before for MODE_COMPOSITE_P (but those don't have any padding
bits) to all floating point types, because e.g. the exact x86 long double
has various bit combinations we don't support, like
pseudo-(denormals,infinities,NaNs) or unnormals.  The HW handles some of
those as exceptional cases and others similarly to the non-pseudo ones.
But for the padding bits it actually doesn't load/store those bits at all,
it loads/stores 10 bytes.  So, I think we should exempt the padding bits
from the reverse comparison (the native_encode_expr bits for the padding
will be all zeros), which the following patch does.  For bit_cast it is
similar to e.g. ignoring padding bits if the destination is a structure
which has padding bits in there.

The change changed auto-init-4.c to how it has been behaving before the
PR105259 change, where some more VCEs can be now done.

2023-03-02  Jakub Jelinek  

PR c++/108934
* fold-const.cc (native_interpret_expr) : Before
memcmp
comparison copy the bytes from ptr to a temporary buffer and
clearing
padding bits in there.

* gcc.target/i386/auto-init-4.c: Revert PR105259 change.
* g++.target/i386/pr108934.C: New test.

(cherry picked from commit cc88366a80e35b3e53141f49d3071010ff3c2ef8)

[Bug debug/108716] [10/11/12 Regression] Incorrect DW_AT_decl_{line,column} in DW_TAG_imported_decl

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108716

--- Comment #4 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:ffc19cb58ef24a27be86f9efa1faaa6ca8ad17b0

commit r12-9281-gffc19cb58ef24a27be86f9efa1faaa6ca8ad17b0
Author: Jakub Jelinek 
Date:   Thu Mar 2 19:17:52 2023 +0100

c++, debug: Fix up locus of DW_TAG_imported_module [PR108716]

Before IMPORTED_DECL has been introduced in PR37410, we used to emit
correct
DW_AT_decl_line on DW_TAG_imported_module on the testcase below, after that
change we haven't emitted it at all for a while and after some time
started emitting incorrect locus, in particular the location of } closing
the function.

The problem is that while we have correct EXPR_LOCATION on the USING_STMT,
when genericizing that USING_STMT into IMPORTED_DECL we don't copy the
location to DECL_SOURCE_LOCATION, so it gets whatever input_location
happens
to be when it is created.

2023-03-02  Jakub Jelinek  

PR debug/108716
* cp-gimplify.cc (cp_genericize_r) : Set
DECL_SOURCE_LOCATION on IMPORTED_DECL to expression location
of USING_STMT or input_location.

* g++.dg/debug/dwarf2/pr108716.C: New test.

(cherry picked from commit 4d82022bfd15d36717bf60a11e75e9ea02204269)

[Bug libquadmath/87204] strtoflt128 produces different results for subnormals with -m32 and -m64

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87204

--- Comment #5 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:7d685cb42c1568f6ac017ea2503b366ec474ce0e

commit r12-9282-g7d685cb42c1568f6ac017ea2503b366ec474ce0e
Author: Jakub Jelinek 
Date:   Fri Mar 3 00:40:13 2023 +0100

libquadmath: Assorted libquadmath strtoflt128 fixes [PR87204, PR94756]

This patch cherry-pickx 8 commits from glibc which fix various strtod_l
bugs.

2023-03-03  niXman  
Jakub Jelinek  

PR libquadmath/87204
PR libquadmath/94756
* strtod/strtod_l.c (round_and_return): Cherry-pick glibc
9310c284ae9 BZ #16151, 4406c41c1d6 BZ #16965 and fcd6b5ac36a
BZ #23279 fixes.
(STRTOF_INTERNAL): Cherry-pick glibc b0debe14fcf BZ #23007,
5556d30caee BZ #18247, 09555b9721d and c6aac3bf366 BZ #26137 and
d84f25c7d87 fixes.

(cherry picked from commit df63f4162c78ef799d4ea9dec3443d5e9c51e5aa)

[Bug c++/16151] Poor diagnostics

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16151

--- Comment #4 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:7d685cb42c1568f6ac017ea2503b366ec474ce0e

commit r12-9282-g7d685cb42c1568f6ac017ea2503b366ec474ce0e
Author: Jakub Jelinek 
Date:   Fri Mar 3 00:40:13 2023 +0100

libquadmath: Assorted libquadmath strtoflt128 fixes [PR87204, PR94756]

This patch cherry-pickx 8 commits from glibc which fix various strtod_l
bugs.

2023-03-03  niXman  
Jakub Jelinek  

PR libquadmath/87204
PR libquadmath/94756
* strtod/strtod_l.c (round_and_return): Cherry-pick glibc
9310c284ae9 BZ #16151, 4406c41c1d6 BZ #16965 and fcd6b5ac36a
BZ #23279 fixes.
(STRTOF_INTERNAL): Cherry-pick glibc b0debe14fcf BZ #23007,
5556d30caee BZ #18247, 09555b9721d and c6aac3bf366 BZ #26137 and
d84f25c7d87 fixes.

(cherry picked from commit df63f4162c78ef799d4ea9dec3443d5e9c51e5aa)

[Bug debug/108967] [11/12 Regression] internal compiler error: in expand_debug_expr, at cfgexpand.cc:5450

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108967

--- Comment #8 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:7b9e837e769474fa5e91958dd2a479837b1176cb

commit r12-9279-g7b9e837e769474fa5e91958dd2a479837b1176cb
Author: Jakub Jelinek 
Date:   Wed Mar 1 10:26:46 2023 +0100

cfgexpand: Handle WIDEN_{PLUS,MINUS}_EXPR and
VEC_WIDEN_{PLUS,MINUS}_{HI,LO}_EXPR in expand_debug_expr [PR108967]

When these tree codes were introduced, expand_debug_expr hasn't been
updated to handle them.  For the VEC_*_EXPR we currently mostly punt, the
non-vector ones can be handled easily.  In release compilers this doesn't
ICE, but with checking we ICE so that we make sure to handle all the needed
tree codes there.

2023-03-01  Jakub Jelinek  

PR debug/108967
* cfgexpand.cc (expand_debug_expr): Handle WIDEN_{PLUS,MINUS}_EXPR
and VEC_WIDEN_{PLUS,MINUS}_{HI,LO}_EXPR.

* g++.dg/debug/pr108967.C: New test.

(cherry picked from commit 520403f324a6ed8b527f39239709dd0841b992e2)

[Bug middle-end/108854] [10/11/12 Regression] tbb-2021.8.0 fails on i686-linux (32-bit), internal compiler error: in expand_expr_real_1, at expr.c:10281 since r10-4511-g6cf67b62c8cda035dccac

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108854

--- Comment #15 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:3a94ae2d7974b363f2b29df75e994ca07819847d

commit r12-9277-g3a94ae2d7974b363f2b29df75e994ca07819847d
Author: Jakub Jelinek 
Date:   Fri Feb 24 11:05:27 2023 +0100

cgraphclones: Don't share DECL_ARGUMENTS between thunk and its artificial
thunk [PR108854]

The following testcase ICEs on x86_64-linux with -m32.  The problem is
we create an artificial thunk and because of -fPIC, ia32 and thunk
destination which doesn't bind locally can't use a mi thunk.
The ICE is because during expansion to RTL we see SSA_NAME for a PARM_DECL,
but the PARM_DECL doesn't have DECL_CONTEXT of the current function.
This is because duplicate_thunk_for_node creates a new DECL_ARGUMENTS chain
only if some arguments need modification.

The following patch fixes it by copying the DECL_ARGUMENTS list even if
the arguments can stay as is, to update DECL_CONTEXT on them.  While for
mi thunks it doesn't really matter because we don't use those arguments
in any way, for other thunks it is important.

2023-02-23  Jakub Jelinek  

PR middle-end/108854
* cgraphclones.cc (duplicate_thunk_for_node): If no parameter
changes are needed, copy at least DECL_ARGUMENTS PARM_DECL
nodes and adjust their DECL_CONTEXT.

* g++.dg/opt/pr108854.C: New test.

(cherry picked from commit 2f1691be517fcdcabae9cd671ab511eb0e08b1d5)

[Bug target/108910] [12/13 Regression] Further ICE in aarch64_layout_arg

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108910

--- Comment #12 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:467a789b0c5e50676bb7e65f861b9d79e0c9fe4c

commit r12-9278-g467a789b0c5e50676bb7e65f861b9d79e0c9fe4c
Author: Jakub Jelinek 
Date:   Wed Mar 1 09:54:52 2023 +0100

lto: Fix up lto_fixup_prevailing_type [PR108910]

Without LTO, TYPE_POINTER_TO/TYPE_REFERENCE_TO chains are only maintained
inside of build_{pointer,reference}_type_for_mode and those routines
ensure that the pointer/reference type added to the chain is really
without any user attributes (unless something would modify the types
in place, but that would be wrong).

Now, LTO adds stuff to these chains in lto_fixup_prevailing_type but
doesn't guarantee that.  The testcase in the PR (which I'm not including
for testsuite because when (I hope) the aarch64 backend bug will be fixed,
the testcase would work either way) shows a case where user has
TYPE_USER_ALIGN type with very high alignment, as there aren't enough
pointers to float in the code left that one becomes the prevailing one
(because types with attributes are created with build_distinct_type_copy
and thus their own TYPE_MAIN_VARIANTs), lto_fixup_prevailing_type puts
it into the TYPE_POINTER_TO chain of float and later on during expansion
of __builtin_cexpif expander uses build_pointer_type (float_type_node)
to emit a sincosf call and instead of getting a normal pointer type gets
this non-standard one.

The following patch fixes that by not adding into those chains
types with TYPE_ATTRIBUTES, and for REFERENCE_TYPEs not even with
TYPE_REF_IS_RVALUE - while the C++ FE adds those into those chains,
it always ensures such a type goes immediately after the corresponding
non-TYPE_REF_IS_RVALUE REFERENCE_TYPE with the same
mode/TYPE_REF_CAN_ALIAS_ALL, so LTO would need to ensure that too, but
TYPE_REF_IS_RVALUE types are looked that way only in the C++ FE.

2023-03-01  Jakub Jelinek  

PR target/108910
* lto-common.cc (lto_fixup_prevailing_type): Don't add t to
TYPE_POINTER_TO or TYPE_REFERENCE_TO chain if it has
TYPE_ATTRIBUTES or is TYPE_REF_IS_RVALUE.

(cherry picked from commit 9b4f7004a77b10bc403875f56c94f73ef86562d8)

[Bug target/108881] "__builtin_ia32_cvtne2ps2bf16_v16hi" compiled only with option -mavx512bf16 report ICE.

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108881

--- Comment #7 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:1b67cce6e55f57a996228646c21b78db1950e4b8

commit r12-9276-g1b67cce6e55f57a996228646c21b78db1950e4b8
Author: Jakub Jelinek 
Date:   Fri Feb 24 10:12:44 2023 +0100

i386: Fix up builtins used in avx512bf16vlintrin.h [PR108881]

The builtins used in avx512bf16vlintrin.h implementation need both
avx512bf16 and avx512vl ISAs, which the header ensures for them, but
the builtins weren't actually requiring avx512vl, so when used by hand
with just -mavx512bf16 -mno-avx512vl it resulted in ICEs.

Fixed by adding OPTION_MASK_ISA_AVX512VL to their BDESC.

2023-02-24  Jakub Jelinek  

PR target/108881
* config/i386/i386-builtin.def (__builtin_ia32_cvtne2ps2bf16_v16hi,
__builtin_ia32_cvtne2ps2bf16_v16hi_mask,
__builtin_ia32_cvtne2ps2bf16_v16hi_maskz,
__builtin_ia32_cvtne2ps2bf16_v8hi,
__builtin_ia32_cvtne2ps2bf16_v8hi_mask,
__builtin_ia32_cvtne2ps2bf16_v8hi_maskz,
__builtin_ia32_cvtneps2bf16_v8sf_mask,
__builtin_ia32_cvtneps2bf16_v8sf_maskz,
__builtin_ia32_cvtneps2bf16_v4sf_mask,
__builtin_ia32_cvtneps2bf16_v4sf_maskz,
__builtin_ia32_dpbf16ps_v8sf, __builtin_ia32_dpbf16ps_v8sf_mask,
__builtin_ia32_dpbf16ps_v8sf_maskz, __builtin_ia32_dpbf16ps_v4sf,
__builtin_ia32_dpbf16ps_v4sf_mask,
__builtin_ia32_dpbf16ps_v4sf_maskz): Require also
OPTION_MASK_ISA_AVX512VL.

* gcc.target/i386/avx512bf16-pr108881.c: New test.

(cherry picked from commit 0ccfa3884f638816af0f5a3f0ee2695e0771ef6d)

[Bug tree-optimization/108819] [12 Regression] ICE on valid code at -O1 with "-fno-tree-ccp -fno-tree-forwprop" on x86_64-linux-gnu: tree check: expected ssa_name, have integer_cst in number_of_iterat

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108819

--- Comment #8 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:7a596c323a9c6af5e8825d2d99892452da7a4e58

commit r12-9275-g7a596c323a9c6af5e8825d2d99892452da7a4e58
Author: Jakub Jelinek 
Date:   Sat Feb 18 12:40:49 2023 +0100

reassoc: Fold some statements [PR108819]

This spot in update_ops can replace one or both of the assign operands with
constants, creating 1 & 1 and similar expressions which can confuse later
passes until they are folded.  Rather than folding both constants by hand
and also handling swapping of operands for commutative ops if the first one
is constant and second one is not, the following patch just uses
fold_stmt_inplace to do that.  I think we shouldn't fold more than the
single statement because that could screw up the rest of the pass, we'd
have
to mark all those with uids, visited and the like.

2023-02-18  Jakub Jelinek  

PR tree-optimization/108819
* tree-ssa-reassoc.cc (update_ops): Fold new stmt in place.

* gcc.dg/pr108819.c: New test.

(cherry picked from commit 32b5875c911f80d551d006d7473e6f1f8705857a)

[Bug target/100758] __builtin_cpu_supports does not (always) detect "sse2"

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100758

--- Comment #25 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:454bf9f4d55058589ac6a76261356cbda599e831

commit r12-9273-g454bf9f4d55058589ac6a76261356cbda599e831
Author: Jakub Jelinek 
Date:   Thu Feb 9 17:43:19 2023 +0100

i386: Call get_available_features for all CPUs with max_level >= 1
[PR100758]

get_available_features doesn't depend on cpu_model2->__cpu_{family,model}
and just sets stuff up based on CPUID leaf 1, or some extended ones,
so I wonder why are we calling it separately for Intel, AMD and Zhaoxin
and not for all other CPUs too?  I think various programs in the wild
which aren't using __builtin_cpu_{is,supports} just check the various CPUID
leafs and query bits in there, without blacklisting unknown CPU vendors,
so I think even __builtin_cpu_supports ("sse2") etc. should be reliable
if those VENDOR_{CENTAUR,CYRIX,NSC,OTHER} CPUs set those bits in CPUID leaf
1 or some extended ones.  Calling it for all CPUs also means it can be
inlined because there will be just a single caller.

I have tested it on Intel and Martin tested it on AMD, but can't test it
on non-Intel/AMD; for Intel/AMD/Zhaoxin it should be really no change in
behavior.

2023-02-09  Jakub Jelinek  

PR target/100758
* common/config/i386/cpuinfo.h (cpu_indicator_init): Call
get_available_features for all CPUs with max_level >= 1, rather
than just Intel or AMD.

(cherry picked from commit b24e9c083093a9e1b1007933a184c02f7ff058db)

[Bug fortran/109186] nearest(huge(x),-1.0_kind(x)) half of correct value

2023-03-18 Thread jvdelisle at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109186

Jerry DeLisle  changed:

   What|Removed |Added

 CC||jvdelisle at gcc dot gnu.org

--- Comment #1 from Jerry DeLisle  ---
Can you clarify what you expect the correct results should be that you expect?

[Bug fortran/109186] New: nearest(huge(x),-1.0_kind(x)) half of correct value

2023-03-18 Thread john.harper at vuw dot ac.nz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109186

Bug ID: 109186
   Summary: nearest(huge(x),-1.0_kind(x)) half of correct value
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: john.harper at vuw dot ac.nz
  Target Milestone: ---

With all four real kinds available in gfortran_12 nearest(x,y) with x = huge
and y = -1 this program gave about half the correct result. Ifort gave correct
results for the 3 different kinds it has: sp,dp,qp.

The program:

  implicit none
  integer,parameter::sp = kind(1.0), dp=kind(1d0), ncases = 2, &
   ep = selected_real_kind(18),qp = selected_real_kind(33)
  character(*),parameter:: fmt(4) = &
   "(A,ES"//["16.08E2","26.17E3","30.20E4","44.34E4"]//")"
  character(24),dimension(2):: splist,dplist,eplist,qplist 
  integer n
  real(sp),parameter::sp1 = 1.0_sp
  real(sp):: spx(ncases) = [huge(sp1),nearest(huge(sp1),-sp1)]
  data splist/'huge(sp1)','nearest(huge(sp1),-sp1)'/
  real(dp),parameter::dp1 = 1.0_dp
  real(dp):: dpx(ncases) = [huge(dp1),nearest(huge(dp1),-dp1)]
  data dplist/'huge(dp1)','nearest(huge(dp1),-dp1)'/
  real(ep),parameter::ep1 = 1.0_ep
  real(ep):: epx(ncases) = [huge(ep1),nearest(huge(ep1),-ep1)]
  data eplist/'huge(ep1)','nearest(huge(ep1),-ep1)'/
  real(qp),parameter::qp1 = 1.0_qp
  real(qp):: qpx(ncases) = [huge(qp1),nearest(huge(qp1),-qp1)]
  data qplist/'huge(qp1)','nearest(huge(qp1),-qp1)'/

  print fmt(1),(splist(n),spx(n),n=1,ncases)
  print fmt(2),(dplist(n),dpx(n),n=1,ncases)
  print fmt(3),(eplist(n),epx(n),n=1,ncases)
  print fmt(4),(qplist(n),qpx(n),n=1,ncases)
end program

The output on ubuntu (Linux 86_64)
huge(sp1) 3.40282347E+38
nearest(huge(sp1),-sp1)   1.70141173E+38
huge(dp1) 1.79769313486231571E+308
nearest(huge(dp1),-dp1)   8.98846567431157854E+307
huge(ep1) 1.18973149535723176502E+4932
nearest(huge(ep1),-ep1)   5.94865747678615882511E+4931
huge(qp1) 1.1897314953572317650857593266280070E+4932
nearest(huge(qp1),-qp1)   5.9486574767861588254287966331400351E+4931

[Bug fortran/108369] FM509 Fails to compile with error when using undocumented -x option

2023-03-18 Thread jvdelisle at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108369

--- Comment #18 from Jerry DeLisle  ---
(In reply to anlauf from comment #17)
> (In reply to Jerry DeLisle from comment #16)
> > Works using the correct compiler option.  We probably should get rid of or
> > change the -x option or document it.
> 
I was imagining deleting it altogether and document that it is deleted and
advise users to use one of the correct options that specifies fixed form. I was
going to wait for 14.

> Is there a way to warn the user that this is a deprecated option that
> will be removed in a future version?  We could start issuing this warning
> immediately and finally remove it e.g. in gcc-14.
> 
> At least we should stop mentioning this option in gcc/doc/invoke.texi,
> so that it does no longer appear in the documentation under "-x language".

I can indeed do this warning in 13 pretty quickly I think.

[Bug c++/109185] ICE in get_partitioning_class, at symtab.cc:2096

2023-03-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109185

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Keywords|lto |link-failure
   Last reconfirmed||2023-03-18

--- Comment #1 from Andrew Pinski  ---
Confirmed. Also fails with linking this:
```
template struct A { static constexpr int  = R; };

template
auto S() {
  static int s;
  return A{};
}

auto  = decltype(S())::value;

int main(void)
{
return s;
}

```

So a front-end issue. Most likely not marking S::s as being used.
Note instead of `decltype(S())::value`, I do `S().value`; it works.

[Bug ipa/109185] New: ICE in get_partitioning_class, at symtab.cc:2096

2023-03-18 Thread asolokha at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109185

Bug ID: 109185
   Summary: ICE in get_partitioning_class, at symtab.cc:2096
   Product: gcc
   Version: 13.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code, lto
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: asolokha at gmx dot com
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

gcc 13.0.1 20230312 snapshot (g:f23dc726875c26f2c38dfded453aa9beba0b9be9) ICEs
when compiling the following testcase, reduced from
test/SemaTemplate/instantiate-static-local.cpp from the clang 15 test suite, w/
-flto:

namespace use_after_instantiation {
  template struct A { static constexpr int  = R; };

  template auto S() {
static int s;
return A{};
  }

  auto  = decltype(S())::value;
}

% g++-13 -flto -c rls6o5bx.cpp
during IPA pass: modref
rls6o5bx.cpp:10:1: internal compiler error: in get_partitioning_class, at
symtab.cc:2096
   10 | }
  | ^
0x7a6b1d symtab_node::get_partitioning_class()
   
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230312/work/gcc-13-20230312/gcc/symtab.cc:2096
0x105d777 lto_output_varpool_node
   
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230312/work/gcc-13-20230312/gcc/lto-cgraph.cc:631
0x105d777 output_symtab()
   
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230312/work/gcc-13-20230312/gcc/lto-cgraph.cc:999
0x1074fdc lto_output()
   
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230312/work/gcc-13-20230312/gcc/lto-streamer-out.cc:2825
0x1103181 write_lto
   
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230312/work/gcc-13-20230312/gcc/passes.cc:2784
0x1103181 ipa_write_summaries_1
   
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230312/work/gcc-13-20230312/gcc/passes.cc:2848
0x1103181 ipa_write_summaries()
   
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230312/work/gcc-13-20230312/gcc/passes.cc:2904
0xd3dd92 ipa_passes
   
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230312/work/gcc-13-20230312/gcc/cgraphunit.cc:2250
0xd3dd92 symbol_table::compile()
   
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230312/work/gcc-13-20230312/gcc/cgraphunit.cc:2323
0xd405e7 symbol_table::compile()
   
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230312/work/gcc-13-20230312/gcc/cgraphunit.cc:2303
0xd405e7 symbol_table::finalize_compilation_unit()
   
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230312/work/gcc-13-20230312/gcc/cgraphunit.cc:2575

[Bug c++/109181] requires expression type requirement rejects valid type when it is a nested member template

2023-03-18 Thread waffl3x at protonmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109181

--- Comment #2 from waffl3x  ---
(In reply to Andrew Pinski from comment #1)
> Confirmed.
> Goes away the way back when -fconcepts support was originally added in GCC
> 6. You can see that with this testcase:
> ```
> struct A {
> template
> using B = int;
> };
> 
> template
> bool go = requires{typename A::template B;};
> ```
> 
> Note back in GCC 6, you needed `-std=c++17 -fconcepts` and also requires was
> only allowed for templates too ..

Ah damn, I'll try to keep in mind that I can use the old enabling flags to go
further back. I'm glad this one wasn't a duplicate, heres hoping I don't find
another bug today

[Bug c++/109177] Call to C++ function marked unavailable gets diagnosed twice

2023-03-18 Thread acoplan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109177

Alex Coplan  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1
   Last reconfirmed||2023-03-18
   Assignee|unassigned at gcc dot gnu.org  |acoplan at gcc dot 
gnu.org

--- Comment #1 from Alex Coplan  ---
Testing a patch.

[Bug fortran/108369] FM509 Fails to compile with error when using undocumented -x option

2023-03-18 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108369

--- Comment #17 from anlauf at gcc dot gnu.org ---
(In reply to Jerry DeLisle from comment #16)
> Works using the correct compiler option.  We probably should get rid of or
> change the -x option or document it.

Is there a way to warn the user that this is a deprecated option that
will be removed in a future version?  We could start issuing this warning
immediately and finally remove it e.g. in gcc-14.

At least we should stop mentioning this option in gcc/doc/invoke.texi,
so that it does no longer appear in the documentation under "-x language".

[Bug fortran/55207] [F08] Variables declared in the main program should implicitly get the SAVE attribute

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207

--- Comment #23 from Paul Thomas  ---
As far as I am aware, this bug has either been fixed or has been worked round
everywhere. However, it doesn't block PR37336 and so I am releasing that
dependency.

Cheers

Paul

[Bug fortran/55207] [F08] Variables declared in the main program should implicitly get the SAVE attribute

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207

Paul Thomas  changed:

   What|Removed |Added

 CC||pault at gcc dot gnu.org
 Blocks|37336, 78122|

--- Comment #22 from Paul Thomas  ---
As far as I am aware, this bug has either been fixed or has been worked round
everywhere. However, it doesn't block PR37336 and so I am releasing that
dependency.

Cheers

Paul


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
[Bug 37336] [F03] Finish derived-type finalization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78122
[Bug 78122] [5/6/7/8 Regression] [F08] ICE in get, at cgraph.h:395

[Bug fortran/37336] [F03] Finish derived-type finalization

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
Bug 37336 depends on bug 107914, which changed state.

Bug 107914 Summary: Finalization errors
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107914

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

[Bug fortran/107914] Finalization errors

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107914

Paul Thomas  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #2 from Paul Thomas  ---
Fixed on mainline

[Bug fortran/37336] [F03] Finish derived-type finalization

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
Bug 37336 depends on bug 106576, which changed state.

Bug 106576 Summary: Finalization of temporaries from functions not occuring
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106576

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug fortran/106576] Finalization of temporaries from functions not occuring

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106576

Paul Thomas  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #9 from Paul Thomas  ---
Thanks for the report Thomas.

I'll be bugging you in a few weeks to backport to 12-branch.

Tschuess

Paul

[Bug fortran/104382] Finalization of parent components not compliant with standard

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104382

Paul Thomas  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #7 from Paul Thomas  ---
Closing as fixed

[Bug fortran/37336] [F03] Finish derived-type finalization

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
Bug 37336 depends on bug 104382, which changed state.

Bug 104382 Summary: Finalization of parent components not compliant with 
standard
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104382

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

[Bug fortran/96122] Segfault when using finalizer

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96122

Paul Thomas  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #7 from Paul Thomas  ---
Hi Andrew,

Thank you for all your recent support on PR37336. I will be putting it to the
gfortran list that I should backport to 12-branch in the next few weeks.

Regards

Paul

[Bug fortran/37336] [F03] Finish derived-type finalization

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
Bug 37336 depends on bug 96122, which changed state.

Bug 96122 Summary: Segfault when using finalizer
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96122

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug fortran/93691] Type bound assignment causes too many finalization of derived type when part of other type

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93691

Paul Thomas  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED
 CC||pault at gcc dot gnu.org

--- Comment #4 from Paul Thomas  ---
Hi Florian,

I am closing this as fixed, even though it runs to the third finalization and
then segfaults, because both nagfor and ifort behave in the same way.

The dump of the code shows that Outer2 is finalized before the assignment and
that both Outer1 and Outer2 are finalized on leaving the block scope. Thus,
alll is as it should be.

Default initializing icount to NULL(), guarding for unassociated icount in
deleteIt gets rid of the segfault.

Thanks for the report.

Paul

[Bug fortran/37336] [F03] Finish derived-type finalization

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
Bug 37336 depends on bug 93691, which changed state.

Bug 93691 Summary: Type bound assignment causes too many finalization of 
derived type when part of other type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93691

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug analyzer/109094] Uninit false positive from -fanalyzer when longjmp unwinds frames with return stmts

2023-03-18 Thread dmalcolm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109094

David Malcolm  changed:

   What|Removed |Added

   Keywords|ice-checking|
   Target Milestone|13.0|12.3
Summary|[13 Regression] ICE in  |Uninit false positive from
   |-fanalyzer seen in qemu's   |-fanalyzer when longjmp
   |target/i386/tcg/translate.c |unwinds frames with return
   ||stmts

--- Comment #10 from David Malcolm  ---
The above patch fixes the ICE for trunk.

This isn't an ICE, but is a false positive for GCC 12:
  https://godbolt.org/z/73EY4TMcx 
which I hope is trivially fixable by backporting this patch.

Keeping open to track the backport to gcc 12; adjusting subject.

[Bug analyzer/109094] [13 Regression] ICE in -fanalyzer seen in qemu's target/i386/tcg/translate.c

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109094

--- Comment #9 from CVS Commits  ---
The master branch has been updated by David Malcolm :

https://gcc.gnu.org/g:430d7d88c1a123d787f529dbc29e6632c6e556fb

commit r13-6749-g430d7d88c1a123d787f529dbc29e6632c6e556fb
Author: David Malcolm 
Date:   Sat Mar 18 12:48:01 2023 -0400

analyzer: fix ICE on certain longjmp calls [PR109094]

PR analyzer/109094 reports an ICE in the analyzer seen on qemu's
target/i386/tcg/translate.c

The issue turned out to be that when handling a longjmp, the code
to pop the frames was generating an svalue for the result_decl of any
popped frame that had a non-void return type (and discarding it) leading
to "uninit" poisoned_svalue_diagnostic instances being saved since the
result_decl is only set by the greturn stmt.  Later, when checking the
feasibility of the path to these diagnostics, m_check_expr was evaluated
in the context of the frame of the longjmp, leading to an attempt to
evaluate the result_decl of each intervening frames whilst in the
context of the topmost frame, leading to an assertion failure in
frame_region::get_region_for_local here:

919 case RESULT_DECL:
920   gcc_assert (DECL_CONTEXT (expr) == m_fun->decl);
921   break;

This patch updates the analyzer's longjmp implementation so that it
doesn't attempt to generate svalues for the result_decls when popping
frames, fixing the assertion failure (and presumably fixing "uninit"
false positives in a release build).

gcc/analyzer/ChangeLog:
PR analyzer/109094
* region-model.cc (region_model::on_longjmp): Pass false for
new "eval_return_svalue" param of pop_frame.
(region_model::pop_frame): Add new "eval_return_svalue" param and
use it to suppress the call to get_rvalue on the result when
needed by on_longjmp.
* region-model.h (region_model::pop_frame): Add new
"eval_return_svalue" param.

gcc/testsuite/ChangeLog:
PR analyzer/109094
* gcc.dg/analyzer/setjmp-pr109094.c: New test.

Signed-off-by: David Malcolm 

[Bug fortran/91316] Derived type finalization failing

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91316

--- Comment #5 from Paul Thomas  ---
Hi Jose,

This is fixed to the extent that it behaves in the same way as ifort.

nagfor, on the other hand, gives:
[pault@pc30 pr37336]$ rm ./a.out;nagfor pr91316.f90 -g;./a.out
NAG Fortran Compiler Release 7.1(Hanzomon) Build 7115
Error: pr91316.f90, line 39: Finaliser FINAL_END for INTENT(OUT) dummy THIS
(no. 1) of pure procedure FINAL_INIT is not pure
Errors in declarations, no further processing for FINAL_INIT
Error: pr91316.f90, line 48: Rank 0 type FINAL_T result variable of pure
function FINAL_SET will invoke an impure final subroutine
Errors in declarations, no further processing for FINAL_SET

Malcolm Cohen has convinced me that this error is correct.
Setting the elemental functions to be impure recovers the expected behaviour
with nagfor.

I will keep this PR open as a place holder for this nit.

Regards

Paul

[Bug fortran/37336] [F03] Finish derived-type finalization

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
Bug 37336 depends on bug 88735, which changed state.

Bug 88735 Summary: Nested assignment triggers call of final method for right 
hand side
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88735

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug fortran/88735] Nested assignment triggers call of final method for right hand side

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88735

Paul Thomas  changed:

   What|Removed |Added

 CC||pault at gcc dot gnu.org
 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Paul Thomas  ---
Fixed on mainline. I will ask to backport to 12-branch in a few weeks.

Thanks for the report.

Paul

[Bug fortran/84472] Missing finalization and memory leak

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84472

Paul Thomas  changed:

   What|Removed |Added

 CC||pault at gcc dot gnu.org

--- Comment #7 from Paul Thomas  ---
Hi Vipul,

This is partially fixed by the patch I just committed. Like ifort, gfortran
does the right finalizations but is hit by a double free. It's on my todo list
to clean up the remaining detritus in pr37336.

Thanks for the report, even if it has taken a while to get to it

Paul

[Bug fortran/108369] FM509 Fails to compile with error when using undocumented -x option

2023-03-18 Thread jvdelisle at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108369

Jerry DeLisle  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |jvdelisle at gcc dot 
gnu.org
 Status|NEW |ASSIGNED
Summary|FM509 Fails to compile with |FM509 Fails to compile with
   |error   |error when using
   ||undocumented -x option

--- Comment #16 from Jerry DeLisle  ---
Works using the correct compiler option.  We probably should get rid of or
change the -x option or document it.

[Bug fortran/82996] ICE and segfault with derived type finalization

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82996

Paul Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||pault at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #12 from Paul Thomas  ---
Fixed on mainline. The testcases now have the same behaviour as ifort and
nagfor.

I will ask to backport to 12-branch in a few weeks.

Cheers

Paul

[Bug fortran/37336] [F03] Finish derived-type finalization

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
Bug 37336 depends on bug 82996, which changed state.

Bug 82996 Summary: ICE and segfault with derived type finalization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82996

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug fortran/37336] [F03] Finish derived-type finalization

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
Bug 37336 depends on bug 80524, which changed state.

Bug 80524 Summary: [F03] Problematic behaviour with a finalization subroutine 
in gfortran
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80524

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug fortran/80524] [F03] Problematic behaviour with a finalization subroutine in gfortran

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80524

Paul Thomas  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #10 from Paul Thomas  ---
Mainline now behaves in the same way as nagfor and ifort with this testcase.
I'll ask to backport to 12-branch in a few weeks.

Cheers

Paul

[Bug tree-optimization/109184] [10/11/12/13 Regression] csmith: really old bug with -O3

2023-03-18 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109184

Jakub Jelinek  changed:

   What|Removed |Added

 CC||amker at gcc dot gnu.org,
   ||jakub at gcc dot gnu.org
   Keywords|needs-bisection |
   Target Milestone|--- |10.5
  Component|c   |tree-optimization
 Ever confirmed|0   |1
   Last reconfirmed||2023-03-18
 Status|UNCONFIRMED |NEW
Summary|csmith: really old bug with |[10/11/12/13 Regression]
   |-O3 |csmith: really old bug with
   ||-O3

--- Comment #4 from Jakub Jelinek  ---
On the #c0 testcase with -O3 -fno-strict-aliasing it started with
r8-5164-gfbdec14e80e9399cd301ed

[Bug fortran/71798] [OOP] failure to finalise temporary

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71798

Paul Thomas  changed:

   What|Removed |Added

 CC||pault at gcc dot gnu.org
 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #4 from Paul Thomas  ---
Fixed on mainline. I will ask to backport to 12-branch in a few weeks.

Paul

[Bug fortran/37336] [F03] Finish derived-type finalization

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
Bug 37336 depends on bug 71798, which changed state.

Bug 71798 Summary: [OOP] failure to finalise temporary
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71798

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug fortran/37336] [F03] Finish derived-type finalization

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
Bug 37336 depends on bug 69298, which changed state.

Bug 69298 Summary: [OOP] Array finalisers seem to be given the wrong array when 
the array is a member variable
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69298

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug fortran/69298] [OOP] Array finalisers seem to be given the wrong array when the array is a member variable

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69298

Paul Thomas  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #10 from Paul Thomas  ---
This is now fixed on mainline. The output of the original testcase is the same
as ifort and nearly the same as nagfor. All the final calls are in the same
places, but the numerical output is sometimes different, where gfortran shows
Finalising stuff_type 0

I am closing this as fixed. Certainly the segfault has gone. I will look to
backport to 12-branch in a few weeks.

Paul

[Bug fortran/67471] [F03] Finalizer not invoked for assignment to array section

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67471

Paul Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||pault at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #3 from Paul Thomas  ---
This is fixed on mainline. I will ask if I can backport to 12-branch in a few
weeks.

Cheers

Paul

[Bug fortran/37336] [F03] Finish derived-type finalization

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
Bug 37336 depends on bug 67471, which changed state.

Bug 67471 Summary: [F03] Finalizer not invoked for assignment to array section
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67471

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug fortran/67444] [F03] RHS in assignment of polymorphic types not finalized

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67444

Paul Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
 CC||pault at gcc dot gnu.org

--- Comment #4 from Paul Thomas  ---
This is now fixed on mainline. Once the dust has settled and any nasties rooted
out, I will ask if I can backport to 12-branch.

Paul

[Bug fortran/37336] [F03] Finish derived-type finalization

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
Bug 37336 depends on bug 67444, which changed state.

Bug 67444 Summary: [F03] RHS in assignment of polymorphic types not finalized
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67444

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug fortran/65347] [F03] Final subroutine not called for function result

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65347

Paul Thomas  changed:

   What|Removed |Added

 CC||pault at gcc dot gnu.org

--- Comment #4 from Paul Thomas  ---
This is partially fixed on mainline and behaves in the same way as nagfor.
Finalization of array and stucture constructors is removed in F2018 and so are
only activated by -std=f2003/8 in gfortran. ifort activates both be default. I
seem to have overlooked finalization of structure constructors or functions
within array constructors. I'll have a look to see why it is not working.

[Bug c/109184] csmith: really old bug with -O3

2023-03-18 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109184

--- Comment #3 from David Binderman  ---
After checking the flags that move -O2 to -O3, flag -floop-interchange
seems to be at fault.

$ ~/gcc/results/bin/gcc -w -O2 -fno-strict-aliasing bug897.c
$ ./a.out 1 > 1
$ ~/gcc/results/bin/gcc -w -O2 -floop-interchange -fno-strict-aliasing bug897.c
$./a.out 1 > 2
$ diff 1 2 | head

2038c2038
< ...checksum after hashing g_1731[i][j] : 351CD463
---
> ...checksum after hashing g_1731[i][j] : 7739D31E
2040c2040
< ...checksum after hashing g_1731[i][j] : 791FAA71
---
> ...checksum after hashing g_1731[i][j] : FEBF8F12

[Bug c/109184] csmith: really old bug with -O3

2023-03-18 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109184

--- Comment #2 from David Binderman  ---
Created attachment 54702
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54702=edit
partially reduced C source code

[Bug fortran/64290] [F03] No finalization at deallocation of LHS

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64290

Paul Thomas  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Paul Thomas  ---
Fixed on mainline. After a while, I will ask the list if a backport to
12-branch is OK.

Cheers

Paul

[Bug fortran/37336] [F03] Finish derived-type finalization

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
Bug 37336 depends on bug 64290, which changed state.

Bug 64290 Summary: [F03] No finalization at deallocation of LHS
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64290

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

[Bug fortran/37336] [F03] Finish derived-type finalization

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
Bug 37336 depends on bug 59694, which changed state.

Bug 59694 Summary: [F03] no finalization of an unused variable
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59694

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

[Bug fortran/59694] [F03] no finalization of an unused variable

2023-03-18 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59694

Paul Thomas  changed:

   What|Removed |Added

 CC||pault at gcc dot gnu.org
 Resolution|--- |FIXED
 Status|REOPENED|RESOLVED

--- Comment #9 from Paul Thomas  ---
Fixed on mainline. After a while, I will ask the list if a backport to
12-branch is OK.

Cheers

Paul

[Bug c/109184] csmith: really old bug with -O3

2023-03-18 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109184

David Binderman  changed:

   What|Removed |Added

   Keywords||needs-bisection

--- Comment #1 from David Binderman  ---
I have a reduction running.

[Bug c/109184] New: csmith: really old bug with -O3

2023-03-18 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109184

Bug ID: 109184
   Summary: csmith: really old bug with -O3
   Product: gcc
   Version: 13.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Created attachment 54701
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54701=edit
C source code

For the attached C code, compiled with -O2 and -O3, produces different answers:

$ ~/gcc/results/bin/gcc -w -O2 -fno-strict-aliasing bug897.c
$ ./a.out 1 > 1
$ $ ~/gcc/results/bin/gcc -w -O3 -fno-strict-aliasing bug897.c
$ ./a.out 1 > 2
$ diff 1 2 | head
2038c2038
< ...checksum after hashing g_1731[i][j] : 351CD463
---
> ...checksum after hashing g_1731[i][j] : 7739D31E
2040c2040
< ...checksum after hashing g_1731[i][j] : 791FAA71
---
> ...checksum after hashing g_1731[i][j] : FEBF8F12

The bug seems to exist since sometime before 20220403, nearly a year ago.

Flag -ftrivial-auto-var-init=zero doesn't seem to help.

[Bug preprocessor/109183] New: [regression?] since GCC 11.1, -MM -MMD generates "a-" prefixed dependency files

2023-03-18 Thread yann at droneaud dot fr via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109183

Bug ID: 109183
   Summary: [regression?] since GCC 11.1, -MM -MMD generates "a-"
prefixed dependency files
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: preprocessor
  Assignee: unassigned at gcc dot gnu.org
  Reporter: yann at droneaud dot fr
  Target Milestone: ---

I've found a rather surprising behavior change when using GCC >= 11.1 to build
some project using custom build environment.

How to reproduce:

: > test.c
gcc -MM -MMD test.c
test -e a-test.d && echo "unexpected dependency file name"

I've git-bisect-ed between GCC 11.1 and GCC 10.1 and the behavior change did
happen as the result of this commit:

commit 1dedc12d186a110854537e1279b4e6c29f2df35a
Author: Alexandre Oliva 
Date:   Tue May 26 04:30:15 2020 -0300

revamp dump and aux output names

   
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=1dedc12d186a110854537e1279b4e6c29f2df35a

I didn't find an explanation there for this behavior change.

It's not noted in the documentation either
https://gcc.gnu.org/onlinedocs/gcc-11.3.0/gcc/Preprocessor-Options.html

So this make me believe it's some kind of regression for a corner case.

I understand the correct usage of -MMD is to be associated with some
processing, -E, -S, -c, etc, while -MM imply -E, so perhaps -MM and -MMD are
mutually exclusive and should not be allowed together. I dunno.

But generating "a-" prefixed dependency files is rather unexpected.

[Bug libitm/88319] all-target and all-target-libitm build targets fail for libitm.

2023-03-18 Thread schwab--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88319

--- Comment #5 from Andreas Schwab  ---
Check the value of ac_cv_prog_CXX.

[Bug libitm/88319] all-target and all-target-libitm build targets fail for libitm.

2023-03-18 Thread doerthous at 21cn dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88319

--- Comment #4 from doerthous  ---
(In reply to Andreas Schwab from comment #3)
> That happens because the compiler name is missing.

Why is it missing? After an installation of libtool in archlinux and rebuild
gcc, it seems work now, thouth the libtool's version is still 2.2.7a.

[Bug libstdc++/109165] std::hash>::operator() should be const

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109165

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

https://gcc.gnu.org/g:9b83d4755a7da02f25788fce14bec949e7045f8f

commit r13-6748-g9b83d4755a7da02f25788fce14bec949e7045f8f
Author: Jonathan Wakely 
Date:   Fri Mar 17 11:39:55 2023 +

libstdc++: Fix test for hash>::operator() [PR109165]

libstdc++-v3/ChangeLog:

PR libstdc++/109165
* testsuite/18_support/coroutines/hash.cc: Use const object
in second call.

[Bug c++/109172] [10/11/12/13 Regression] g++ calls a private destructor with the keyword throw after the try-block

2023-03-18 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109172

--- Comment #8 from Jonathan Wakely  ---
(In reply to Jason Merrill from comment #5)
> Fixed for GCC 13.  In general I'm not inclined to backport accepts-invalid
> fixes, but am open to discussion.

The fact nobody reported it until now suggests it's not a big deal.

[Bug c++/109172] [10/11/12/13 Regression] g++ calls a private destructor with the keyword throw after the try-block

2023-03-18 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109172

--- Comment #7 from Jonathan Wakely  ---
No. This line means the test has to exit with an error referring to that line
of the source, and it must contain the string "private":

  throw *new Demo;  // { dg-error private }

If it compiles without a matching error, the test fails. It doesn't matter
whether it links successfully or not.

In any case, the default action for compiler tests is to compile them, and not
try to link, so it would never give a linker error even if the expected
compilation error is absent.

https://gcc.gnu.org/onlinedocs/gccint/Directives.html documents the default
action, which is { dg-do compile }.

If the test contained { dg-do link } or { dg-do run } then there would be a
linker error if the private destructor wasn't diagnosed, but that still
wouldn't match the expected error on line 12.

[Bug libitm/88319] all-target and all-target-libitm build targets fail for libitm.

2023-03-18 Thread schwab--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88319

--- Comment #3 from Andreas Schwab  ---
That happens because the compiler name is missing.

[Bug libitm/88319] all-target and all-target-libitm build targets fail for libitm.

2023-03-18 Thread doerthous at 21cn dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88319

--- Comment #2 from doerthous  ---
(In reply to doerthous from comment #1)
> Comfired on target: arm-linux-gnueabi with uclibc. gcc 11.2.0
> 
> 
> 
> It seems like libtool take the `-B' option as it's own option which is not
> recognized by libtool's option process.
> 
> # the option process loop in libtool script looks like: 
> case $opt in
>   --debug) #...;;
>   --mode) #...;;
>   -dlopen=*|--mode=*|--tag=*) #...;;
>   --help) #...;;
>   -*) func_fatal_help "unrecognized option \`$opt'" ;; # here raise the error
>   *) nonopt="$opt"
>   break
>   ;;
> esac
> 
> Is this a bug?
> 
> 
> 
> Error Info:
> 
> make[3]: Entering directory
> '/root/build/gcc-11.2.0/build_arm_s2/arm-linux-gnueabi/libitm'
> /bin/sh ./libtool  --tag=CXX   --mode=compile 
> -B/root/build/gcc-11.2.0/build_arm_s2/arm-linux-gnueabi/libstdc++-v3/src/.
> libs
> -B/root/build/gcc-11.2.0/build_arm_s2/arm-linux-gnueabi/libstdc++-v3/
> libsupc++/.libs -B/tmp/sysroot/arm/toolchain/arm-linux-gnueabi/bin/
> -B/tmp/sysroot/arm/toolchain/arm-linux-gnueabi/lib/ -isystem
> /tmp/sysroot/arm/toolchain/arm-linux-gnueabi/include -isystem
> /tmp/sysroot/arm/toolchain/arm-linux-gnueabi/sys-include
> --sysroot=/tmp/sysroot/arm   -DHAVE_CONFIG_H -I. -I../../../libitm 
> -I../../../libitm/config/linux/arm -I../../../libitm/config/linux
> -I../../../libitm/config/arm -I../../../libitm/config/posix
> -I../../../libitm/config/generic -I../../../libitm  -ftls-model=initial-exec
> -Wall -Werror  -Wc,-pthread  -std=gnu++0x -funwind-tables -fno-exceptions
> -fno-rtti -fabi-version=4 -g -O2 -D_GNU_SOURCE -MT aatree.lo -MD -MP -MF
> .deps/aatree.Tpo -c -o aatree.lo ../../../libitm/aatree.cc
> libtool: compile: unrecognized option
> `-B/root/build/gcc-11.2.0/build_arm_s2/arm-linux-gnueabi/libstdc++-v3/src/.
> libs'
> libtool: compile: Try `libtool --help' for more information.
> make[3]: *** [Makefile:678: aatree.lo] Error 1
> make[3]: Leaving directory
> '/root/build/gcc-11.2.0/build_arm_s2/arm-linux-gnueabi/libitm'
> make[2]: *** [Makefile:836: all-recursive] Error 1
> make[2]: Leaving directory
> '/root/build/gcc-11.2.0/build_arm_s2/arm-linux-gnueabi/libitm'
> make[1]: *** [Makefile:518: all] Error 2
> make[1]: Leaving directory
> '/root/build/gcc-11.2.0/build_arm_s2/arm-linux-gnueabi/libitm'
> make: *** [Makefile:17051: all-target-libitm] Error 2
> 
> 
> 
> Environment Info:
> 
> sh-5.1# uname -a
> Linux 0206568d6f54 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2
> 00:30:59 UTC 2022 x86_64 GNU/Linux
> sh-5.1# cat /etc/os-release
> NAME="Arch Linux"
> PRETTY_NAME="Arch Linux"
> ID=arch
> BUILD_ID=rolling
> VERSION_ID=TEMPLATE_VERSION_ID
> ANSI_COLOR="38;2;23;147;209"
> HOME_URL="https://archlinux.org/;
> DOCUMENTATION_URL="https://wiki.archlinux.org/;
> SUPPORT_URL="https://bbs.archlinux.org/;
> BUG_REPORT_URL="https://bugs.archlinux.org/;
> PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/;
> LOGO=archlinux-logo



Libtool Info:
sh-5.1# ./libtool --help
Usage: libtool [OPTION]... [MODE-ARG]...

Provide generalized library-building support services.

  --config show all configuration variables
  --debug  enable verbose shell tracing
  -n, --dry-rundisplay commands without modifying any files
  --features   display basic configuration information and exit
  --mode=MODE  use operation mode MODE
  --no-finish  let install mode avoid finish commands
  --preserve-dup-deps  don't remove duplicate dependency libraries
  --quiet, --silentdon't print informational messages
  --no-quiet, --no-silent
   print informational messages (default)
  --tag=TAGuse configuration variables from tag TAG
  -v, --verboseprint more informational messages than default
  --no-verbose don't print the extra informational messages
  --versionprint version information
  -h, --help, --help-all   print short, long, or detailed help message

MODE must be one of the following:

clean  remove files from the build directory
compilecompile a source file into a libtool object
executeautomatically set library path, then run a program
finish complete the installation of libtool libraries
installinstall libraries or executables
link   create a library or an executable
uninstall  remove libraries from an installed directory

MODE-ARGS vary depending on the MODE.  When passed as first option,
`--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
Try `libtool --help --mode=MODE' for a more detailed description of MODE.

When reporting a bug, please describe a test case to reproduce it and
include the following information:

host-triplet:   arm-unknown-linux-gnueabi
shell:  /bin/sh

[Bug libitm/88319] all-target and all-target-libitm build targets fail for libitm.

2023-03-18 Thread doerthous at 21cn dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88319

doerthous  changed:

   What|Removed |Added

 CC||doerthous at 21cn dot com

--- Comment #1 from doerthous  ---
Comfired on target: arm-linux-gnueabi with uclibc. gcc 11.2.0



It seems like libtool take the `-B' option as it's own option which is not
recognized by libtool's option process.

# the option process loop in libtool script looks like: 
case $opt in
  --debug) #...;;
  --mode) #...;;
  -dlopen=*|--mode=*|--tag=*) #...;;
  --help) #...;;
  -*) func_fatal_help "unrecognized option \`$opt'" ;; # here raise the error
  *) nonopt="$opt"
  break
  ;;
esac

Is this a bug?



Error Info:

make[3]: Entering directory
'/root/build/gcc-11.2.0/build_arm_s2/arm-linux-gnueabi/libitm'
/bin/sh ./libtool  --tag=CXX   --mode=compile 
-B/root/build/gcc-11.2.0/build_arm_s2/arm-linux-gnueabi/libstdc++-v3/src/.libs
-B/root/build/gcc-11.2.0/build_arm_s2/arm-linux-gnueabi/libstdc++-v3/libsupc++/.libs
-B/tmp/sysroot/arm/toolchain/arm-linux-gnueabi/bin/
-B/tmp/sysroot/arm/toolchain/arm-linux-gnueabi/lib/ -isystem
/tmp/sysroot/arm/toolchain/arm-linux-gnueabi/include -isystem
/tmp/sysroot/arm/toolchain/arm-linux-gnueabi/sys-include
--sysroot=/tmp/sysroot/arm   -DHAVE_CONFIG_H -I. -I../../../libitm 
-I../../../libitm/config/linux/arm -I../../../libitm/config/linux
-I../../../libitm/config/arm -I../../../libitm/config/posix
-I../../../libitm/config/generic -I../../../libitm  -ftls-model=initial-exec
-Wall -Werror  -Wc,-pthread  -std=gnu++0x -funwind-tables -fno-exceptions
-fno-rtti -fabi-version=4 -g -O2 -D_GNU_SOURCE -MT aatree.lo -MD -MP -MF
.deps/aatree.Tpo -c -o aatree.lo ../../../libitm/aatree.cc
libtool: compile: unrecognized option
`-B/root/build/gcc-11.2.0/build_arm_s2/arm-linux-gnueabi/libstdc++-v3/src/.libs'
libtool: compile: Try `libtool --help' for more information.
make[3]: *** [Makefile:678: aatree.lo] Error 1
make[3]: Leaving directory
'/root/build/gcc-11.2.0/build_arm_s2/arm-linux-gnueabi/libitm'
make[2]: *** [Makefile:836: all-recursive] Error 1
make[2]: Leaving directory
'/root/build/gcc-11.2.0/build_arm_s2/arm-linux-gnueabi/libitm'
make[1]: *** [Makefile:518: all] Error 2
make[1]: Leaving directory
'/root/build/gcc-11.2.0/build_arm_s2/arm-linux-gnueabi/libitm'
make: *** [Makefile:17051: all-target-libitm] Error 2



Environment Info:

sh-5.1# uname -a
Linux 0206568d6f54 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59
UTC 2022 x86_64 GNU/Linux
sh-5.1# cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
VERSION_ID=TEMPLATE_VERSION_ID
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/;
DOCUMENTATION_URL="https://wiki.archlinux.org/;
SUPPORT_URL="https://bbs.archlinux.org/;
BUG_REPORT_URL="https://bugs.archlinux.org/;
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/;
LOGO=archlinux-logo

[Bug fortran/106576] Finalization of temporaries from functions not occuring

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106576

--- Comment #8 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

[Bug fortran/88735] Nested assignment triggers call of final method for right hand side

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88735

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

[Bug fortran/82996] ICE and segfault with derived type finalization

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82996

--- Comment #11 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

[Bug fortran/84472] Missing finalization and memory leak

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84472

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

[Bug fortran/67471] [F03] Finalizer not invoked for assignment to array section

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67471

--- Comment #2 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

[Bug fortran/80524] [F03] Problematic behaviour with a finalization subroutine in gfortran

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80524

--- Comment #9 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

[Bug fortran/93691] Type bound assignment causes too many finalization of derived type when part of other type

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93691

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

[Bug fortran/37336] [F03] Finish derived-type finalization

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336

--- Comment #32 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

[Bug fortran/70863] [F03] Finalization of array of derived type causes segfault

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70863

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

[Bug fortran/71798] [OOP] failure to finalise temporary

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71798

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

[Bug fortran/96122] Segfault when using finalizer

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96122

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

[Bug fortran/91316] Derived type finalization failing

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91316

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

[Bug fortran/69298] [OOP] Array finalisers seem to be given the wrong array when the array is a member variable

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69298

--- Comment #9 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

[Bug fortran/64290] [F03] No finalization at deallocation of LHS

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64290

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

[Bug fortran/67444] [F03] RHS in assignment of polymorphic types not finalized

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67444

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

[Bug fortran/103854] ICE in generate_finalization_wrapper, at fortran/class.c:1618 since r8-4344-gaea5e9327a49bc73

2023-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103854

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:d7caf313525a46f200d7f5db1ba893f853774aee

commit r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee
Author: Paul Thomas 
Date:   Sat Mar 18 07:56:23 2023 +

Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.

  1   2   >