* [Bug fortran/108349] LTO mismatch for __builtin_realloc between glibc and gfortran frontend
2023-01-10 9:28 [Bug fortran/108349] New: LTO mismatch for __builtin_realloc between glibc and gfortran frontend rimvydas.jas at gmail dot com
@ 2023-01-10 9:48 ` rguenth at gcc dot gnu.org
2023-01-10 10:14 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-10 9:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108349
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2023-01-10
Status|UNCONFIRMED |NEW
Keywords| |wrong-code
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed - the Fortran frontend type is wrong (oops).
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/108349] LTO mismatch for __builtin_realloc between glibc and gfortran frontend
2023-01-10 9:28 [Bug fortran/108349] New: LTO mismatch for __builtin_realloc between glibc and gfortran frontend rimvydas.jas at gmail dot com
2023-01-10 9:48 ` [Bug fortran/108349] " rguenth at gcc dot gnu.org
@ 2023-01-10 10:14 ` jakub at gcc dot gnu.org
2023-01-10 10:20 ` jakub at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-10 10:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108349
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Caused by r0-100026-gb64fca63690ad6042bea, before that it was
tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node);
tmp = tree_cons (NULL_TREE, size_type_node, tmp);
ftype = build_function_type (pvoid_type_node, tmp);
which is correct. Let me eyeball the other changes in that commit.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/108349] LTO mismatch for __builtin_realloc between glibc and gfortran frontend
2023-01-10 9:28 [Bug fortran/108349] New: LTO mismatch for __builtin_realloc between glibc and gfortran frontend rimvydas.jas at gmail dot com
2023-01-10 9:48 ` [Bug fortran/108349] " rguenth at gcc dot gnu.org
2023-01-10 10:14 ` jakub at gcc dot gnu.org
@ 2023-01-10 10:20 ` jakub at gcc dot gnu.org
2023-01-10 11:11 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-10 10:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108349
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems e.g. sincos* have wrong prototypes since that revision too.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/108349] LTO mismatch for __builtin_realloc between glibc and gfortran frontend
2023-01-10 9:28 [Bug fortran/108349] New: LTO mismatch for __builtin_realloc between glibc and gfortran frontend rimvydas.jas at gmail dot com
` (2 preceding siblings ...)
2023-01-10 10:20 ` jakub at gcc dot gnu.org
@ 2023-01-10 11:11 ` jakub at gcc dot gnu.org
2023-01-11 9:42 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-10 11:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108349
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54225
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54225&action=edit
gcc13-pr108349.patch
Untested fix.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/108349] LTO mismatch for __builtin_realloc between glibc and gfortran frontend
2023-01-10 9:28 [Bug fortran/108349] New: LTO mismatch for __builtin_realloc between glibc and gfortran frontend rimvydas.jas at gmail dot com
` (3 preceding siblings ...)
2023-01-10 11:11 ` jakub at gcc dot gnu.org
@ 2023-01-11 9:42 ` cvs-commit at gcc dot gnu.org
2023-01-11 14:03 ` tschwinge at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-11 9:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108349
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:0986c351aa8a9f08b3cb614baec13564dd62c114
commit r13-5100-g0986c351aa8a9f08b3cb614baec13564dd62c114
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Jan 11 10:40:54 2023 +0100
fortran: Fix up function types for realloc and sincos{,f,l} builtins
[PR108349]
As reported in the PR, the FUNCTION_TYPE for __builtin_realloc in the
Fortran FE is wrong since r0-100026-gb64fca63690ad which changed
- tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node);
- tmp = tree_cons (NULL_TREE, size_type_node, tmp);
- ftype = build_function_type (pvoid_type_node, tmp);
+ ftype = build_function_type_list (pvoid_type_node,
+ size_type_node, pvoid_type_node,
+ NULL_TREE);
gfc_define_builtin ("__builtin_realloc", ftype, BUILT_IN_REALLOC,
"realloc", false);
The return type is correct, void *, but the first argument should be
void * too and only second one size_t, while the above change changed
realloc to be void *__builtin_realloc (size_t, void *);
I went through all other changes from that commit and found that
__builtin_sincos{,f,l} got broken as well, instead of the former
void __builtin_sincos{,f,l} (ftype, ftype *, ftype *);
where ftype is {double,float,long double} it is now incorrectly
void __builtin_sincos{,f,l} (ftype *, ftype *);
The following patch fixes that, plus some formatting issues around
the spots I've changed.
2023-01-11 Jakub Jelinek <jakub@redhat.com>
PR fortran/108349
* f95-lang.cc (gfc_init_builtin_function): Fix up function types
for BUILT_IN_REALLOC and BUILT_IN_SINCOS{F,,L}. Formatting fixes.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/108349] LTO mismatch for __builtin_realloc between glibc and gfortran frontend
2023-01-10 9:28 [Bug fortran/108349] New: LTO mismatch for __builtin_realloc between glibc and gfortran frontend rimvydas.jas at gmail dot com
` (4 preceding siblings ...)
2023-01-11 9:42 ` cvs-commit at gcc dot gnu.org
@ 2023-01-11 14:03 ` tschwinge at gcc dot gnu.org
2023-02-10 17:45 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2023-01-11 14:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108349
Thomas Schwinge <tschwinge at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org,
| |tschwinge at gcc dot gnu.org,
| |vries at gcc dot gnu.org
--- Comment #6 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
As nvptx target is known to be sensitive to such mismatches (outside of the LTO
context reported here), I individually did test this commit
r13-5100-g0986c351aa8a9f08b3cb614baec13564dd62c114 "fortran: Fix up function
types for realloc and sincos{,f,l} builtins [PR108349]", and found that it also
resolves the following nvptx target compilation failures:
'gfortran.dg/pr35662.f90':
ptxas /tmp/ccYNgEEN.o, line 44; error : Illegal operand type to
instruction 'st'
ptxas /tmp/ccYNgEEN.o, line 51; error : Type of argument does not match
formal parameter '%in_ar0'
ptxas /tmp/ccYNgEEN.o, line 51; error : Alignment of argument does not
match formal parameter '%in_ar0'
ptxas /tmp/ccYNgEEN.o, line 44; error : Unknown symbol '%stack'
ptxas fatal : Ptx assembly aborted due to errors
nvptx-as: ptxas returned 255 exit status
'gfortran.fortran-torture/compile/pr37236.f':
ptxas [...]/build-gcc/gcc/testsuite/gfortran/pr37236.o, line 269; error :
Illegal operand type to instruction 'st'
ptxas [...]/build-gcc/gcc/testsuite/gfortran/pr37236.o, line 275; error :
Type of argument does not match formal parameter '%in_ar0'
ptxas [...]/build-gcc/gcc/testsuite/gfortran/pr37236.o, line 269; error :
Unknown symbol '%stack'
ptxas fatal : Ptx assembly aborted due to errors
nvptx-as: ptxas returned 255 exit status
These are now all-PASS.
In the nvptx target gfortran test suite logs remain however dozens more similar
instances. I've not checked if what's underlying those would also be exposing
the same kind of LTO problem.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/108349] LTO mismatch for __builtin_realloc between glibc and gfortran frontend
2023-01-10 9:28 [Bug fortran/108349] New: LTO mismatch for __builtin_realloc between glibc and gfortran frontend rimvydas.jas at gmail dot com
` (5 preceding siblings ...)
2023-01-11 14:03 ` tschwinge at gcc dot gnu.org
@ 2023-02-10 17:45 ` cvs-commit at gcc dot gnu.org
2023-05-02 20:13 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-10 17:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108349
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:463bf7cfb0b03d9e75754ea8ba89c61186d0982f
commit r12-9139-g463bf7cfb0b03d9e75754ea8ba89c61186d0982f
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Jan 11 10:40:54 2023 +0100
fortran: Fix up function types for realloc and sincos{,f,l} builtins
[PR108349]
As reported in the PR, the FUNCTION_TYPE for __builtin_realloc in the
Fortran FE is wrong since r0-100026-gb64fca63690ad which changed
- tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node);
- tmp = tree_cons (NULL_TREE, size_type_node, tmp);
- ftype = build_function_type (pvoid_type_node, tmp);
+ ftype = build_function_type_list (pvoid_type_node,
+ size_type_node, pvoid_type_node,
+ NULL_TREE);
gfc_define_builtin ("__builtin_realloc", ftype, BUILT_IN_REALLOC,
"realloc", false);
The return type is correct, void *, but the first argument should be
void * too and only second one size_t, while the above change changed
realloc to be void *__builtin_realloc (size_t, void *);
I went through all other changes from that commit and found that
__builtin_sincos{,f,l} got broken as well, instead of the former
void __builtin_sincos{,f,l} (ftype, ftype *, ftype *);
where ftype is {double,float,long double} it is now incorrectly
void __builtin_sincos{,f,l} (ftype *, ftype *);
The following patch fixes that, plus some formatting issues around
the spots I've changed.
2023-01-11 Jakub Jelinek <jakub@redhat.com>
PR fortran/108349
* f95-lang.cc (gfc_init_builtin_function): Fix up function types
for BUILT_IN_REALLOC and BUILT_IN_SINCOS{F,,L}. Formatting fixes.
(cherry picked from commit 0986c351aa8a9f08b3cb614baec13564dd62c114)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/108349] LTO mismatch for __builtin_realloc between glibc and gfortran frontend
2023-01-10 9:28 [Bug fortran/108349] New: LTO mismatch for __builtin_realloc between glibc and gfortran frontend rimvydas.jas at gmail dot com
` (6 preceding siblings ...)
2023-02-10 17:45 ` cvs-commit at gcc dot gnu.org
@ 2023-05-02 20:13 ` cvs-commit at gcc dot gnu.org
2023-05-03 15:20 ` cvs-commit at gcc dot gnu.org
2023-05-04 7:23 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-02 20:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108349
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:d67efd5a4ff7ef0992c641b04b009195d872f7bd
commit r11-10698-gd67efd5a4ff7ef0992c641b04b009195d872f7bd
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Jan 11 10:40:54 2023 +0100
fortran: Fix up function types for realloc and sincos{,f,l} builtins
[PR108349]
As reported in the PR, the FUNCTION_TYPE for __builtin_realloc in the
Fortran FE is wrong since r0-100026-gb64fca63690ad which changed
- tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node);
- tmp = tree_cons (NULL_TREE, size_type_node, tmp);
- ftype = build_function_type (pvoid_type_node, tmp);
+ ftype = build_function_type_list (pvoid_type_node,
+ size_type_node, pvoid_type_node,
+ NULL_TREE);
gfc_define_builtin ("__builtin_realloc", ftype, BUILT_IN_REALLOC,
"realloc", false);
The return type is correct, void *, but the first argument should be
void * too and only second one size_t, while the above change changed
realloc to be void *__builtin_realloc (size_t, void *);
I went through all other changes from that commit and found that
__builtin_sincos{,f,l} got broken as well, instead of the former
void __builtin_sincos{,f,l} (ftype, ftype *, ftype *);
where ftype is {double,float,long double} it is now incorrectly
void __builtin_sincos{,f,l} (ftype *, ftype *);
The following patch fixes that, plus some formatting issues around
the spots I've changed.
2023-01-11 Jakub Jelinek <jakub@redhat.com>
PR fortran/108349
* f95-lang.c (gfc_init_builtin_function): Fix up function types
for BUILT_IN_REALLOC and BUILT_IN_SINCOS{F,,L}. Formatting fixes.
(cherry picked from commit 0986c351aa8a9f08b3cb614baec13564dd62c114)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/108349] LTO mismatch for __builtin_realloc between glibc and gfortran frontend
2023-01-10 9:28 [Bug fortran/108349] New: LTO mismatch for __builtin_realloc between glibc and gfortran frontend rimvydas.jas at gmail dot com
` (7 preceding siblings ...)
2023-05-02 20:13 ` cvs-commit at gcc dot gnu.org
@ 2023-05-03 15:20 ` cvs-commit at gcc dot gnu.org
2023-05-04 7:23 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-03 15:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108349
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:532cbd4d96285dce2440424faff30e5cc94954e4
commit r10-11355-g532cbd4d96285dce2440424faff30e5cc94954e4
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Jan 11 10:40:54 2023 +0100
fortran: Fix up function types for realloc and sincos{,f,l} builtins
[PR108349]
As reported in the PR, the FUNCTION_TYPE for __builtin_realloc in the
Fortran FE is wrong since r0-100026-gb64fca63690ad which changed
- tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node);
- tmp = tree_cons (NULL_TREE, size_type_node, tmp);
- ftype = build_function_type (pvoid_type_node, tmp);
+ ftype = build_function_type_list (pvoid_type_node,
+ size_type_node, pvoid_type_node,
+ NULL_TREE);
gfc_define_builtin ("__builtin_realloc", ftype, BUILT_IN_REALLOC,
"realloc", false);
The return type is correct, void *, but the first argument should be
void * too and only second one size_t, while the above change changed
realloc to be void *__builtin_realloc (size_t, void *);
I went through all other changes from that commit and found that
__builtin_sincos{,f,l} got broken as well, instead of the former
void __builtin_sincos{,f,l} (ftype, ftype *, ftype *);
where ftype is {double,float,long double} it is now incorrectly
void __builtin_sincos{,f,l} (ftype *, ftype *);
The following patch fixes that, plus some formatting issues around
the spots I've changed.
2023-01-11 Jakub Jelinek <jakub@redhat.com>
PR fortran/108349
* f95-lang.c (gfc_init_builtin_function): Fix up function types
for BUILT_IN_REALLOC and BUILT_IN_SINCOS{F,,L}. Formatting fixes.
(cherry picked from commit 0986c351aa8a9f08b3cb614baec13564dd62c114)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/108349] LTO mismatch for __builtin_realloc between glibc and gfortran frontend
2023-01-10 9:28 [Bug fortran/108349] New: LTO mismatch for __builtin_realloc between glibc and gfortran frontend rimvydas.jas at gmail dot com
` (8 preceding siblings ...)
2023-05-03 15:20 ` cvs-commit at gcc dot gnu.org
@ 2023-05-04 7:23 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-04 7:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108349
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 10.5 too.
^ permalink raw reply [flat|nested] 11+ messages in thread