[Bug fortran/115390] Bogus -Wuninitialized warning when using CHARACTER(*) argument in BIND(C) function

2024-06-19 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115390

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #6 from anlauf at gcc dot gnu.org ---
Fixed.

[Bug fortran/115390] Bogus -Wuninitialized warning when using CHARACTER(*) argument in BIND(C) function

2024-06-19 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115390

--- Comment #5 from GCC Commits  ---
The master branch has been updated by Harald Anlauf :

https://gcc.gnu.org/g:954f9011c4923b72f42cc6ca8460333e7c7aad98

commit r15-1449-g954f9011c4923b72f42cc6ca8460333e7c7aad98
Author: Harald Anlauf 
Date:   Tue Jun 18 21:57:19 2024 +0200

Fortran: fix for CHARACTER(len=*) dummies with bind(C) [PR115390]

gcc/fortran/ChangeLog:

PR fortran/115390
* trans-decl.cc (gfc_conv_cfi_to_gfc): Move derivation of type
sizes
for character via gfc_trans_vla_type_sizes to after character
length
has been set.

gcc/testsuite/ChangeLog:

PR fortran/115390
* gfortran.dg/bind_c_char_11.f90: New test.

[Bug fortran/115390] Bogus -Wuninitialized warning when using CHARACTER(*) argument in BIND(C) function

2024-06-18 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115390

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P4
   Assignee|unassigned at gcc dot gnu.org  |anlauf at gcc dot 
gnu.org

--- Comment #4 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2024-June/060591.html

[Bug fortran/115390] Bogus -Wuninitialized warning when using CHARACTER(*) argument in BIND(C) function

2024-06-17 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115390

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 CC||anlauf at gcc dot gnu.org

--- Comment #3 from anlauf at gcc dot gnu.org ---
Created attachment 58455
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58455=edit
Patch

The attached patch fixes the ordering such that the bogus warning does no
longer appear and gives for the reduced test:

__attribute__((fn spec (". r ")))
void bar (struct CFI_cdesc_t00 & restrict _s)
{
  integer(kind=8) s.0;
  character(kind=1)[1:s.0] * s;
  bitsizetype D.4279;
  sizetype D.4280;

  s.0 = (integer(kind=8)) _s->elem_len;
  D.4279 = (bitsizetype) (sizetype) NON_LVALUE_EXPR  * 8;
  D.4280 = (sizetype) NON_LVALUE_EXPR ;
  s = (character(kind=1)[1:s.0] *) _s->base_addr;
  foo ((character(kind=1)[1:s.0] *) s, s.0);
}

Currently regtesting ...

[Bug fortran/115390] Bogus -Wuninitialized warning when using CHARACTER(*) argument in BIND(C) function

2024-06-08 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115390

--- Comment #2 from anlauf at gcc dot gnu.org ---
Slightly rewritten (we only need the interface of foo):

module test
  implicit none
  interface
 subroutine foo(s)
   character(*), intent(in) :: s
 end subroutine foo
  end interface
contains
  subroutine bar(s) bind(c)
character(*), intent(in) :: s
call foo(s)
  end
end

This gives:

__attribute__((fn spec (". r ")))
void bar (struct CFI_cdesc_t00 & restrict _s)
{
  integer(kind=8) s.0;
  character(kind=1)[1:s.0] * s;
  bitsizetype D.4279;
  sizetype D.4280;

  D.4279 = (bitsizetype) (sizetype) NON_LVALUE_EXPR  * 8;
  D.4280 = (sizetype) NON_LVALUE_EXPR ;
  s.0 = (integer(kind=8)) _s->elem_len;
  s = (character(kind=1)[1:s.0] *) _s->base_addr;
  foo ((character(kind=1)[1:s.0] *) s, s.0);
}

[Bug fortran/115390] Bogus -Wuninitialized warning when using CHARACTER(*) argument in BIND(C) function

2024-06-07 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115390

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2024-06-07
   Keywords||diagnostic, wrong-code
 Ever confirmed|0   |1

--- Comment #1 from Andrew Pinski  ---
Confirmed.