public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] hppa: Fix bind_c_coms.f90 and bind_c_vars.f90 tests on hppa
@ 2024-01-08 20:38 John David Anglin
  0 siblings, 0 replies; only message in thread
From: John David Anglin @ 2024-01-08 20:38 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 2059 bytes --]

Tested on hppa64-hp-hpux11.11.  Committed to trunk.

Dave
---

hppa: Fix bind_c_coms.f90 and bind_c_vars.f90 tests on hppa

Commit 6271dd98 changed the default from -fcommon to -fno-common.
This silently changed the alignment of uninitialized BSS data on
hppa where the alignment of common data must be greater or equal
to the alignment of the largest type that will fit in the block.
For example, the alignment of `double d[2];' changed from 16 to 8
on hppa64.

The hppa architecture requires strict alignment and the linker
warns about inconsistent alignment of variables.  This change broke
the gfortran.dg/bind_c_coms.f90 and gfortran.dg/bind_c_vars.f90
tests.  These tests check whether bind_c works between fortran
and C.

Adding the -fcommon option fixes the tests.  Probably, gcc and HP
C are now by default inconsistent but that's water under the bridge.

2024-01-08  John David Anglin  <danglin@gcc.gnu.org>

gcc/testsuite/ChangeLog:

	PR testsuite/94253
	* gfortran.dg/bind_c_coms.f90: Add -fcommon option on hppa*-*-*.
	* gfortran.dg/bind_c_vars.f90: Likewise.

diff --git a/gcc/testsuite/gfortran.dg/bind_c_coms.f90 b/gcc/testsuite/gfortran.dg/bind_c_coms.f90
index 85ead9fb636..2f9714947c7 100644
--- a/gcc/testsuite/gfortran.dg/bind_c_coms.f90
+++ b/gcc/testsuite/gfortran.dg/bind_c_coms.f90
@@ -3,6 +3,7 @@
 ! { dg-options "-w" }
 ! the -w option is to prevent the warning about long long ints
 module bind_c_coms
+! { dg-additional-options "-fcommon" { target hppa*-*-hpux* } }
   use, intrinsic :: iso_c_binding
   implicit none
 
diff --git a/gcc/testsuite/gfortran.dg/bind_c_vars.f90 b/gcc/testsuite/gfortran.dg/bind_c_vars.f90
index 4f4a0cfd795..ede3ffd8c21 100644
--- a/gcc/testsuite/gfortran.dg/bind_c_vars.f90
+++ b/gcc/testsuite/gfortran.dg/bind_c_vars.f90
@@ -1,6 +1,7 @@
 ! { dg-do run }
 ! { dg-additional-sources bind_c_vars_driver.c }
 module bind_c_vars
+! { dg-additional-options "-fcommon" { target hppa*-*-hpux* } }
   use, intrinsic :: iso_c_binding
   implicit none
 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-08 20:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-08 20:38 [committed] hppa: Fix bind_c_coms.f90 and bind_c_vars.f90 tests on hppa John David Anglin

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).