bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* attribute: Work around compiler bug of Oracle cc 12.6
@ 2024-03-29 13:40 Bruno Haible
  0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2024-03-29 13:40 UTC (permalink / raw
  To: bug-gnulib

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

The test-uninames.sh test fails, when compiled by cc from Oracle Developer
Studio 12.6:
  - on Solaris/sparc64, regardless of optimization,
  - on Solaris/x86_64 and Linux/x86_64, when not optimizing (just "cc -m64").

This patch fixes it, by disabling the use of __attribute__ ((__packed__))
with this compiler. Find attached also a standalone test case.


2024-03-29  Bruno Haible  <bruno@clisp.org>

	attribute: Work around compiler bug of Oracle cc 12.6.
	* m4/gnulib-common.m4 (gl_COMMON_BODY): Expand _GL_ATTRIBUTE_PACKED to
	empty on SunPRO C.

diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index d8d0904f78..d028b0ac2a 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 92
+# gnulib-common.m4 serial 93
 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -504,8 +504,10 @@ AC_DEFUN([gl_COMMON_BODY]
    minimizing the memory required.  */
 /* Applies to: struct members, struct, union,
    in C++ also: class.  */
+/* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite
+   __has_attribute OK.  */
 #ifndef _GL_ATTRIBUTE_PACKED
-# if _GL_HAS_ATTRIBUTE (packed)
+# if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C
 #  define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__))
 # else
 #  define _GL_ATTRIBUTE_PACKED

[-- Attachment #2: foo.c.xz --]
[-- Type: application/x-xz, Size: 197632 bytes --]

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

only message in thread, other threads:[~2024-03-29 13:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-29 13:40 attribute: Work around compiler bug of Oracle cc 12.6 Bruno Haible

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