Bug 20303 - [4.0 only] Can't push more than 16 nested visibility
Summary: [4.0 only] Can't push more than 16 nested visibility
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: visibility
Depends on:
Blocks:
 
Reported: 2005-03-03 18:20 UTC by H.J. Lu
Modified: 2006-08-15 18:45 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-12-27 00:25:44


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2005-03-03 18:20:15 UTC
When

#pragma GCC visibility push(default)
#pragma GCC visibility pop

are used for header file wrappers, we may have more 16

#pragma GCC visibility push(default)

Currently gcc will fail.
Comment 1 Andrew Pinski 2005-03-03 18:43:41 UTC
This is a documented behavior.
Comment 2 H.J. Lu 2005-03-03 18:47:20 UTC
It makes it less useful for header file wrappers. Supporting the case of N (N>16)

#pragma GCC visibility push(default)

followed by N

#pragma GCC visibility pop

shouldn't be very hard.
Comment 3 H.J. Lu 2005-03-03 19:19:19 UTC
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2005-03/msg00238.html
Comment 4 jsm-csl@polyomino.org.uk 2005-03-03 22:58:09 UTC
Subject: Re:  Can't push more than 16 nested visibility

On Thu, 3 Mar 2005, pinskia at gcc dot gnu dot org wrote:

> This is a documented behavior.

Arbitrary limits are still generally undesirable, even when documented.

Some limits are very unlikely to be reached by real programs, even 
computer-generated ones, and genuinely motivated by efficiency.  For 
example, the C front end only supports 268435455 (= 2^28 - 1) nested 
scopes.  If there were a real use for more scopes, or for a very few 
programs to exceed other such limits motivated by efficiency concerns, we 
could add a --enable-huge-programs configure option to increase those 
limits at some performance cost to almost all normal programs.  Another 
limit in a similar situation is the limit of USHRT_MAX parameters to a 
preprocessor macro.

In this case, the limit is reached by real code and I very much doubt 
(without profiling information to show to the contrary) that there would 
be any measurable performance difference with using VEC, so we should just 
do that and get rid of the limit.

Comment 5 Giovanni Bajo 2005-03-03 23:00:45 UTC
(In reply to comment #4)

I strongly agree with everything in JSM's post. There is simply no reason for 
keeping such a stupid limit, and even less for manually optimizing conditions 
to enhance the limit. Using a VEC is more than enough for this case.
Comment 6 H.J. Lu 2005-04-05 18:36:30 UTC
A new patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2005-04/msg00567.html
Comment 7 GCC Commits 2005-05-30 18:49:15 UTC
Subject: Bug 20303

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	hjl@gcc.gnu.org	2005-05-30 18:49:04

Modified files:
	gcc            : ChangeLog c-pragma.c 
	gcc/doc        : invoke.texi 

Log message:
	2005-05-30  H.J. Lu  <hongjiu.lu@intel.com>
	
	PR middle-end/20303
	* c-pragma.c: Include "vec.h".
	(handle_pragma_visibility): Use VEC.
	
	* doc/invoke.texi: Remove the nested visibility push limit.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8947&r2=2.8948
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-pragma.c.diff?cvsroot=gcc&r1=1.85&r2=1.86
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&r1=1.626&r2=1.627

Comment 8 H.J. Lu 2005-05-30 18:51:30 UTC
Fixed on mainline.
Comment 9 H.J. Lu 2005-05-30 18:52:01 UTC
Fixed on mainline.
Comment 10 Jakub Jelinek 2005-07-14 15:33:52 UTC
Any reason why this hasn't been fixed on gcc-4_0-branch as well?
Comment 11 H.J. Lu 2005-07-14 17:25:18 UTC
A patch for gcc 4.0 is posted at

http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00994.html
Comment 12 GCC Commits 2005-07-25 07:39:04 UTC
Subject: Bug 20303

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jakub@gcc.gnu.org	2005-07-25 07:38:58

Modified files:
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: visibility-d.c 

Log message:
	PR middle-end/20303
	* gcc.dg/visibility-d.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5812&r2=1.5813
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/visibility-d.c.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 13 Jakub Jelinek 2005-11-21 09:43:16 UTC
Subject: Bug 20303

Author: jakub
Date: Mon Nov 21 09:43:10 2005
New Revision: 107290

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=107290
Log:
2005-05-18  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/20303
	* c-pragma.c: Include "vec.h".
	(handle_pragma_visibility): Use VEC.

	* doc/invoke.texi: Remove the nested visibility push limit.

2005-07-22  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/20303
	* gcc.dg/visibility-d.c: New test.

Added:
    branches/gcc-4_0-rhl-branch/gcc/testsuite/gcc.dg/visibility-d.c
Modified:
    branches/gcc-4_0-rhl-branch/gcc/ChangeLog
    branches/gcc-4_0-rhl-branch/gcc/c-pragma.c
    branches/gcc-4_0-rhl-branch/gcc/doc/invoke.texi
    branches/gcc-4_0-rhl-branch/gcc/testsuite/ChangeLog

Comment 14 Andrew Pinski 2006-08-15 18:45:51 UTC
Fixed in 4.1.0, this was not a regression.