public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix fc-prototypes usage with C_INT64_T and non LP64 Targets.
@ 2023-03-30  3:47 Andrew Pinski
  2023-03-30 17:39 ` Thomas Koenig
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Pinski @ 2023-03-30  3:47 UTC (permalink / raw)
  To: gcc-patches, fortran; +Cc: Andrew Pinski

The problem here is we were outputing long_long instead of
"long long". This was just an oversight and a missing check.

Committed as obvious after a bootstrap/test on x86_64-linux-gnu.

gcc/fortran/ChangeLog:

	* dump-parse-tree.cc (get_c_type_name): Fix "long_long"
	type name to be "long long". Add a comment on why adding
	2 to the name too.
---
 gcc/fortran/dump-parse-tree.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc
index 3b24bdc1a6c..f4490da6a19 100644
--- a/gcc/fortran/dump-parse-tree.cc
+++ b/gcc/fortran/dump-parse-tree.cc
@@ -3696,7 +3696,10 @@ get_c_type_name (gfc_typespec *ts, gfc_array_spec *as, const char **pre,
 	  if (c_interop_kinds_table[i].f90_type == ts->type
 	      && c_interop_kinds_table[i].value == ts->kind)
 	    {
+	      /* Skip over 'c_'. */
 	      *type_name = c_interop_kinds_table[i].name + 2;
+	      if (strcmp (*type_name, "long_long") == 0)
+		*type_name = "long long";
 	      if (strcmp (*type_name, "signed_char") == 0)
 		*type_name = "signed char";
 	      else if (strcmp (*type_name, "size_t") == 0)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix fc-prototypes usage with C_INT64_T and non LP64 Targets.
  2023-03-30  3:47 [PATCH] Fix fc-prototypes usage with C_INT64_T and non LP64 Targets Andrew Pinski
@ 2023-03-30 17:39 ` Thomas Koenig
  2023-03-30 19:05   ` Steve Kargl
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Koenig @ 2023-03-30 17:39 UTC (permalink / raw)
  To: Andrew Pinski, gcc-patches, fortran

Hi Andrew,

> "long long". This was just an oversight and a missing check.
> 
> Committed as obvious after a bootstrap/test on x86_64-linux-gnu.

Thanks!

I think this one is obvious enough that it deserves a backport.
I've cherry-picked this for gcc12, will do gcc11 tomorrow.

Best regards

	Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix fc-prototypes usage with C_INT64_T and non LP64 Targets.
  2023-03-30 17:39 ` Thomas Koenig
@ 2023-03-30 19:05   ` Steve Kargl
  2023-04-01  8:24     ` Thomas Koenig
  0 siblings, 1 reply; 4+ messages in thread
From: Steve Kargl @ 2023-03-30 19:05 UTC (permalink / raw)
  To: Thomas Koenig via Fortran; +Cc: Andrew Pinski, gcc-patches

On Thu, Mar 30, 2023 at 07:39:55PM +0200, Thomas Koenig via Fortran wrote:
> Hi Andrew,
> 
> > "long long". This was just an oversight and a missing check.
> > 
> > Committed as obvious after a bootstrap/test on x86_64-linux-gnu.
> 
> Thanks!
> 
> I think this one is obvious enough that it deserves a backport.
> I've cherry-picked this for gcc12, will do gcc11 tomorrow.
> 

The patch is incomplete.

module foo
 use, intrinsic :: iso_c_binding
 implicit none
 public :: bar
 type, bind(c) :: bar
  real(10) a
 end type
end module

This yields

typedef struct bar {
long_double a /* WARNING: Converting 'REAL(10)' to interoperable type */;
} bar;

That should be 'long double'.

-- 
Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix fc-prototypes usage with C_INT64_T and non LP64 Targets.
  2023-03-30 19:05   ` Steve Kargl
@ 2023-04-01  8:24     ` Thomas Koenig
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Koenig @ 2023-04-01  8:24 UTC (permalink / raw)
  To: sgk, Thomas Koenig via Fortran; +Cc: Andrew Pinski, gcc-patches

Hi Steve,

>> Hi Andrew,
>>
>>> "long long". This was just an oversight and a missing check.
>>>
>>> Committed as obvious after a bootstrap/test on x86_64-linux-gnu.
>>
>> Thanks!
>>
>> I think this one is obvious enough that it deserves a backport.
>> I've cherry-picked this for gcc12, will do gcc11 tomorrow.
>>
> 
> The patch is incomplete.
> 
> module foo
>   use, intrinsic :: iso_c_binding
>   implicit none
>   public :: bar
>   type, bind(c) :: bar
>    real(10) a
>   end type
> end module
> 
> This yields
> 
> typedef struct bar {
> long_double a /* WARNING: Converting 'REAL(10)' to interoperable type */;
> } bar;
> 
> That should be 'long double'.

Fixed as obvious in 69044e11ac5 .

I will backport soon.

Thanks for the heads-up!

Best regards

	Thomas


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-01  8:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-30  3:47 [PATCH] Fix fc-prototypes usage with C_INT64_T and non LP64 Targets Andrew Pinski
2023-03-30 17:39 ` Thomas Koenig
2023-03-30 19:05   ` Steve Kargl
2023-04-01  8:24     ` Thomas Koenig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).