public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gconv.h: fix build with GCC 6.3 or later
@ 2016-10-19 15:06 Aurelien Jarno
  2016-11-05 21:52 ` Joseph Myers
  0 siblings, 1 reply; 3+ messages in thread
From: Aurelien Jarno @ 2016-10-19 15:06 UTC (permalink / raw)
  To: libc-alpha; +Cc: Aurelien Jarno

gconv.h is using a flex array to define the __gconv_info member in an
invalid way, causing the future GCC 6.3 (ie the gcc-6-branch) or the
future GCC 7 (ie the master branch) to issue an error:

| In file included from ../include/gconv.h:1:0,
|                  from ../sysdeps/unix/sysv/linux/_G_config.h:32,
|                  from ../libio/libio.h:31,
|                  from ../include/libio.h:4,
|                  from ../libio/stdio.h:74,
|                  from ../include/stdio.h:5,
|                  from test-math-isinff.cc:22:
| ../iconv/gconv.h:142:50: error: flexible array member '__gconv_info::__data' not at end of 'struct _IO_codecvt'
| In file included from ../include/libio.h:4:0,
|                  from ../libio/stdio.h:74,
|                  from ../include/stdio.h:5,
|                  from test-math-isinff.cc:22:
| ../libio/libio.h:211:14: note: next member '_G_iconv_t _IO_codecvt::__cd_out' declared here
| ../libio/libio.h:187:8: note: in the definition of 'struct _IO_codecvt'
| In file included from ../include/gconv.h:1:0,
|                  from ../sysdeps/unix/sysv/linux/_G_config.h:32,
|                  from ../libio/libio.h:31,
|                  from ../include/libio.h:4,
|                  from ../libio/stdio.h:74,
|                  from ../include/stdio.h:5,
|                  from test-math-isinff.cc:22:
| ../iconv/gconv.h:142:50: error: flexible array member '__gconv_info::__data' not at end of 'struct _IO_wide_data'
| In file included from ../include/libio.h:4:0,
|                  from ../libio/stdio.h:74,
|                  from ../include/stdio.h:5,
|                  from test-math-isinff.cc:22:
| ../libio/libio.h:211:14: note: next member '_G_iconv_t _IO_codecvt::__cd_out' declared here
| ../libio/libio.h:215:8: note: in the definition of 'struct _IO_wide_data'

This is basically a revert to the code from 15 years ago. More details
are available in the GCC bug:
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78039

Changelog:
	* iconv/gconv.h (__gconv_info): Define __data element using a
	zero-length array.
---
 ChangeLog     | 5 +++++
 iconv/gconv.h | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 9b22678..1922c5b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-10-19  Aurelien Jarno  <aurelien@aurel32.net>
+
+	* iconv/gconv.h (__gconv_info): Define __data element using a
+	zero-length array.
+
 2016-10-19  Joseph Myers  <joseph@codesourcery.com>
 
 	* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
diff --git a/iconv/gconv.h b/iconv/gconv.h
index 8d8ce58..a870280 100644
--- a/iconv/gconv.h
+++ b/iconv/gconv.h
@@ -139,7 +139,7 @@ typedef struct __gconv_info
 {
   size_t __nsteps;
   struct __gconv_step *__steps;
-  __extension__ struct __gconv_step_data __data __flexarr;
+  __extension__ struct __gconv_step_data __data[0];
 } *__gconv_t;
 
 /* Transliteration using the locale's data.  */
-- 
2.9.3

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

* Re: [PATCH] gconv.h: fix build with GCC 6.3 or later
  2016-10-19 15:06 [PATCH] gconv.h: fix build with GCC 6.3 or later Aurelien Jarno
@ 2016-11-05 21:52 ` Joseph Myers
  2016-11-06 20:33   ` Aurelien Jarno
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph Myers @ 2016-11-05 21:52 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: libc-alpha

On Wed, 19 Oct 2016, Aurelien Jarno wrote:

> 	* iconv/gconv.h (__gconv_info): Define __data element using a
> 	zero-length array.

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH] gconv.h: fix build with GCC 6.3 or later
  2016-11-05 21:52 ` Joseph Myers
@ 2016-11-06 20:33   ` Aurelien Jarno
  0 siblings, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2016-11-06 20:33 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

On 2016-11-05 21:52, Joseph Myers wrote:
> On Wed, 19 Oct 2016, Aurelien Jarno wrote:
> 
> > 	* iconv/gconv.h (__gconv_info): Define __data element using a
> > 	zero-length array.
> 
> OK.

Thanks for the review. Note that in the meantime GCC upstream reverted
the change from the GCC 6 branch, but it's still there in the trunk. I
have adjusted the commit message in consequence before committing it.

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

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

end of thread, other threads:[~2016-11-06 20:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-19 15:06 [PATCH] gconv.h: fix build with GCC 6.3 or later Aurelien Jarno
2016-11-05 21:52 ` Joseph Myers
2016-11-06 20:33   ` Aurelien Jarno

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