diff mbox

sparc: Char arrays are 64-bit aligned on SPARC

Message ID 20240105071913.593978-1-cederman@gaisler.com
State New
Headers show

Commit Message

Daniel Cederman Jan. 5, 2024, 7:19 a.m. UTC
pr88077 fails on SPARC since char HeaderStr[1] in pr88077_1.c and
long HeaderStr in pr88077_0.c differs in alignment.

warning: alignment 4 of normal symbol `HeaderStr' in c_lto_pr88077_0.o is
smaller than 8 used by the common definition in c_lto_pr88077_1.o

gcc/testsuite/ChangeLog:

	* gcc.dg/lto/pr88077_0.c: Change type to match alignment for SPARC
---
 gcc/testsuite/gcc.dg/lto/pr88077_0.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Eric Botcazou Jan. 8, 2024, 9:20 a.m. UTC | #1
> pr88077 fails on SPARC since char HeaderStr[1] in pr88077_1.c and
> long HeaderStr in pr88077_0.c differs in alignment.
> 
> warning: alignment 4 of normal symbol `HeaderStr' in c_lto_pr88077_0.o is
> smaller than 8 used by the common definition in c_lto_pr88077_1.o

I have never seen it though.  Is that really a warning issued by GCC?
Daniel Cederman Jan. 8, 2024, 11:42 a.m. UTC | #2
On 2024-01-08 10:20, Eric Botcazou wrote:
>> pr88077 fails on SPARC since char HeaderStr[1] in pr88077_1.c and
>> long HeaderStr in pr88077_0.c differs in alignment.
>>
>> warning: alignment 4 of normal symbol `HeaderStr' in c_lto_pr88077_0.o is
>> smaller than 8 used by the common definition in c_lto_pr88077_1.o
> 
> I have never seen it though.  Is that really a warning issued by GCC?
> 

Hello Eric! Thank you for reviewing the patches!

No, this warning is not from GCC, it is from binutils ld. I forgot to 
mention that in the message. I get a similar warning from older versions 
of ld, so I do not think it is a new warning. It is also there with GCC 10.

For the OK:ed patches (with your changes), can I push them to 
release/gcc-13 in addition to master?

/Daniel
Eric Botcazou Jan. 9, 2024, 8:45 a.m. UTC | #3
> Hello Eric! Thank you for reviewing the patches!

You're welcome.

> No, this warning is not from GCC, it is from binutils ld. I forgot to
> mention that in the message. I get a similar warning from older versions
> of ld, so I do not think it is a new warning. It is also there with GCC 10.

I see, thanks for the explanation, the patch is OK then.

> For the OK:ed patches (with your changes), can I push them to
> release/gcc-13 in addition to master?

Sure.
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.dg/lto/pr88077_0.c b/gcc/testsuite/gcc.dg/lto/pr88077_0.c
index 924fe9fc3f01..9455295051fc 100644
--- a/gcc/testsuite/gcc.dg/lto/pr88077_0.c
+++ b/gcc/testsuite/gcc.dg/lto/pr88077_0.c
@@ -1,3 +1,7 @@ 
 /* { dg-lto-do link } */
 
+#if defined __sparc__
+long long HeaderStr;
+#else
 long HeaderStr;
+#endif