public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c/13856] New: hidden support broken with builtin functions @ 2004-01-25 12:28 aj at gcc dot gnu dot org 2004-01-25 12:29 ` [Bug c/13856] " aj at gcc dot gnu dot org ` (14 more replies) 0 siblings, 15 replies; 16+ messages in thread From: aj at gcc dot gnu dot org @ 2004-01-25 12:28 UTC (permalink / raw) To: gcc-bugs With current GCC 3.4 I cannot build glibc anymore, it fails with: /builds/glibc/3.4/libc.so.6: undefined reference to `__GI_strncmp' /builds/glibc/3.4/libc.so.6: undefined reference to `__GI_strftime' /builds/glibc/3.4/libc.so.6: undefined reference to `__GI_fputs_unlocked' /builds/glibc/3.4/libc.so.6: undefined reference to `__GI_fwrite_unlocked' /builds/glibc/3.4/libc.so.6: undefined reference to `__GI_memmove' /builds/glibc/3.4/libc.so.6: undefined reference to `__GI_strncpy' /builds/glibc/3.4/libc.so.6: undefined reference to `__GI__exit' /builds/glibc/3.4/libc.so.6: undefined reference to `__GI_strstr' collect2: ld returned 1 exit status Let's look at fputs_unlocked: The 3.3 branch compiles the file to use the following symbols: $ nm libio/iofputs_u.os U _GLOBAL_OFFSET_TABLE_ 0000000000000000 T __GI_fputs_unlocked 0000000000000000 T fputs_unlocked U strlen 3.4 compiles to: $ nm libio/iofputs_u.os U __GI_fputs_unlocked U __GI_strlen 0000000000000000 T fputs_unlocked Looking further into this, I see the following difference between 3.4 and 3.3 in the assembler files: 3.3 branch outputs: .globl fputs_unlocked ; .set fputs_unlocked, __GI_fputs_unlocked #NO_APP .p2align 4,,15 .globl __GI_fputs_unlocked .hidden __GI_fputs_unlocked .type __GI_fputs_unlocked, @function __GI_fputs_unlocked: But 3.4 does: .globl fputs_unlocked ; .set fputs_unlocked, __GI_fputs_unlocked #NO_APP .p2align 4,,15 .globl fputs_unlocked .type fputs_unlocked, @function fputs_unlocked: I'm appending a small test program for this. Looking at the produced assembler files, you'll see the difference directly. -- Summary: hidden support broken with builtin functions Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: critical Priority: P2 Component: c AssignedTo: zack at codesourcery dot com ReportedBy: aj at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: x86_64-linux-gnu GCC host triplet: x86_64-linux-gnu GCC target triplet: x86_64-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/13856] hidden support broken with builtin functions 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org @ 2004-01-25 12:29 ` aj at gcc dot gnu dot org 2004-01-25 12:30 ` aj at gcc dot gnu dot org ` (13 subsequent siblings) 14 siblings, 0 replies; 16+ messages in thread From: aj at gcc dot gnu dot org @ 2004-01-25 12:29 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From aj at gcc dot gnu dot org 2004-01-25 12:29 ------- Created an attachment (id=5572) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5572&action=view) Testcase that shows failure -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/13856] hidden support broken with builtin functions 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org 2004-01-25 12:29 ` [Bug c/13856] " aj at gcc dot gnu dot org @ 2004-01-25 12:30 ` aj at gcc dot gnu dot org 2004-01-25 15:52 ` [Bug c/13856] [3.4 Regression] " pinskia at gcc dot gnu dot org ` (12 subsequent siblings) 14 siblings, 0 replies; 16+ messages in thread From: aj at gcc dot gnu dot org @ 2004-01-25 12:30 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From aj at gcc dot gnu dot org 2004-01-25 12:30 ------- Note, this shows on x86-64 but I see nothing target specific. I get the same results on i686-linux-gnu -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/13856] [3.4 Regression] hidden support broken with builtin functions 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org 2004-01-25 12:29 ` [Bug c/13856] " aj at gcc dot gnu dot org 2004-01-25 12:30 ` aj at gcc dot gnu dot org @ 2004-01-25 15:52 ` pinskia at gcc dot gnu dot org 2004-01-26 6:30 ` [Bug c/13856] [3.4/3.5 " aj at gcc dot gnu dot org ` (11 subsequent siblings) 14 siblings, 0 replies; 16+ messages in thread From: pinskia at gcc dot gnu dot org @ 2004-01-25 15:52 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2004-01-25 15:51 ------- Confirmed. Here is a shorter testcase: int fputs_unlocked(__const char *__restrict __s, int *__restrict __stream) __asm__ ("" "__GI_fputs_unlocked") __attribute__ ((visibility ("hidden"))); int fputs_unlocked (str, fp) const char *str; int *fp; { } __asm__ (".globl fputs_unlocked ; .set fputs_unlocked, __GI_fputs_unlocked"); -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed| |1 Keywords| |wrong-code Last reconfirmed|0000-00-00 00:00:00 |2004-01-25 15:51:55 date| | Summary|hidden support broken with |[3.4 Regression] hidden |builtin functions |support broken with builtin | |functions Target Milestone|--- |3.4.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/13856] [3.4/3.5 Regression] hidden support broken with builtin functions 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org ` (2 preceding siblings ...) 2004-01-25 15:52 ` [Bug c/13856] [3.4 Regression] " pinskia at gcc dot gnu dot org @ 2004-01-26 6:30 ` aj at gcc dot gnu dot org 2004-02-01 13:28 ` pinskia at gcc dot gnu dot org ` (10 subsequent siblings) 14 siblings, 0 replies; 16+ messages in thread From: aj at gcc dot gnu dot org @ 2004-01-26 6:30 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From aj at gcc dot gnu dot org 2004-01-26 06:30 ------- (In reply to comment #3) > Confirmed. > Here is a shorter testcase: > int fputs_unlocked(__const char *__restrict __s, int *__restrict __stream) __asm__ ("" > "__GI_fputs_unlocked") __attribute__ ((visibility ("hidden"))); > int > fputs_unlocked (str, fp) > const char *str; > int *fp; Are you sure this works without warnings? Is the builtin just declared with a pointer as second argument? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/13856] [3.4/3.5 Regression] hidden support broken with builtin functions 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org ` (3 preceding siblings ...) 2004-01-26 6:30 ` [Bug c/13856] [3.4/3.5 " aj at gcc dot gnu dot org @ 2004-02-01 13:28 ` pinskia at gcc dot gnu dot org 2004-02-03 20:19 ` uweigand at gcc dot gnu dot org ` (9 subsequent siblings) 14 siblings, 0 replies; 16+ messages in thread From: pinskia at gcc dot gnu dot org @ 2004-02-01 13:28 UTC (permalink / raw) To: gcc-bugs -- What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|zack at codesourcery dot com|zack at gcc dot gnu dot org Status|NEW |ASSIGNED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/13856] [3.4/3.5 Regression] hidden support broken with builtin functions 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org ` (4 preceding siblings ...) 2004-02-01 13:28 ` pinskia at gcc dot gnu dot org @ 2004-02-03 20:19 ` uweigand at gcc dot gnu dot org 2004-02-03 20:47 ` uweigand at gcc dot gnu dot org ` (8 subsequent siblings) 14 siblings, 0 replies; 16+ messages in thread From: uweigand at gcc dot gnu dot org @ 2004-02-03 20:19 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From uweigand at gcc dot gnu dot org 2004-02-03 20:19 ------- We're seeing this problem on s390 as well. (B.t.w. this doesn't appear to have anything to do with "builtin functions", does it?) >From my initial experiments, it would appear that the problem is caused by the K&R-style function definition -- when using a C89-style definition like int fputs_unlocked (const char *str, int *fp) everything works as expected. Maybe something goes wrong when merging attributes between the declaration and definition type nodes in case the latter is K&R? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/13856] [3.4/3.5 Regression] hidden support broken with builtin functions 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org ` (5 preceding siblings ...) 2004-02-03 20:19 ` uweigand at gcc dot gnu dot org @ 2004-02-03 20:47 ` uweigand at gcc dot gnu dot org 2004-02-03 21:25 ` zack at gcc dot gnu dot org ` (7 subsequent siblings) 14 siblings, 0 replies; 16+ messages in thread From: uweigand at gcc dot gnu dot org @ 2004-02-03 20:47 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From uweigand at gcc dot gnu dot org 2004-02-03 20:47 ------- Sorry, I was wrong: of course this is related to builtin functions. In fact, the current behaviour is directly caused by Zack's patch to fix PR 18314 (http://gcc.gnu.org/ml/gcc-patches/2004-01/msg02475.html). What happens is that - first, we have a builtin declaration - second, we get an excplicit declaration which matches the builtin; it provides new attributes that are merged into the builtin decl - third, we get a K&R definition; after Zack's patch K&R definitions are considered to always override the builtin decl, hence the builtin decl is thrown away together with the changed attributes Is this behaviour wrong? Is the source code valid in the first place? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/13856] [3.4/3.5 Regression] hidden support broken with builtin functions 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org ` (6 preceding siblings ...) 2004-02-03 20:47 ` uweigand at gcc dot gnu dot org @ 2004-02-03 21:25 ` zack at gcc dot gnu dot org 2004-02-08 1:52 ` cvs-commit at gcc dot gnu dot org ` (6 subsequent siblings) 14 siblings, 0 replies; 16+ messages in thread From: zack at gcc dot gnu dot org @ 2004-02-03 21:25 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From zack at gcc dot gnu dot org 2004-02-03 21:25 ------- The source code is fine. I think what needs to happen is that the various special cases for builtin functions should only apply if the builtin is still invisible (C_DECL_INVISIBLE (olddecl)) -- if it is visible, then there was a declaration in the source code, and following declarations must agree with that one. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/13856] [3.4/3.5 Regression] hidden support broken with builtin functions 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org ` (7 preceding siblings ...) 2004-02-03 21:25 ` zack at gcc dot gnu dot org @ 2004-02-08 1:52 ` cvs-commit at gcc dot gnu dot org 2004-02-08 1:54 ` zack at codesourcery dot com ` (5 subsequent siblings) 14 siblings, 0 replies; 16+ messages in thread From: cvs-commit at gcc dot gnu dot org @ 2004-02-08 1:52 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-02-08 01:52 ------- Subject: Bug 13856 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: zack@gcc.gnu.org 2004-02-08 01:52:52 Modified files: gcc : ChangeLog c-decl.c cgraphunit.c dwarf2out.c tree-inline.c tree.h gcc/cp : ChangeLog decl.c optimize.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.dg: visibility-8.c Log message: Bug 13856 * c-decl.c (diagnose_mismatched_decls): Only give special treatment when olddecl is DECL_BUILT_IN, if C_DECL_INVISIBLE is also true. (merge_decls): Don't clear DECL_BUILT_IN_CLASS and DECL_FUNCTION_CODE when defining a built-in function. Don't update DECL_ESTIMATED_INSNS. * dwarf2out.c (dwarf2out_decl): Don't ignore built-in FUNCTION_DECLs. * tree.h: Delete DECL_ESTIMATED_INSNS. * tree-inline.c (struct inline_data): Delete inlined_insns field. (expand_call_inline, optimize_inline_calls): Don't update DECL_ESTIMATED_INSNS nor inlined_insns. * cgraphunit.c (cgraph_analyze_function): Don't update DECL_ESTIMATED_INSNS. cp: * optimize.c (maybe_clone_body): Don't update DECL_ESTIMATED_INSNS. * decl.c (duplicate_decls, start_function): Likewise. testsuite: * gcc.dg/visibility-8.c: New testcase. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.158&r2=2.2326.2.159 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.470.4.4&r2=1.470.4.5 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cgraphunit.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.46.2.4&r2=1.46.2.5 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.478.2.3&r2=1.478.2.4 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-inline.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.90.4.1&r2=1.90.4.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.458.2.3&r2=1.458.2.4 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.45&r2=1.3892.2.46 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1174.2.7&r2=1.1174.2.8 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/optimize.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.103.4.1&r2=1.103.4.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.60&r2=1.3389.2.61 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/visibility-8.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/13856] [3.4/3.5 Regression] hidden support broken with builtin functions 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org ` (8 preceding siblings ...) 2004-02-08 1:52 ` cvs-commit at gcc dot gnu dot org @ 2004-02-08 1:54 ` zack at codesourcery dot com 2004-02-08 1:59 ` cvs-commit at gcc dot gnu dot org ` (4 subsequent siblings) 14 siblings, 0 replies; 16+ messages in thread From: zack at codesourcery dot com @ 2004-02-08 1:54 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From zack at codesourcery dot com 2004-02-08 01:53 ------- Subject: c-decl.c rewrite: fix bug 13856 Bug 13856 reports that a visibility:hidden attribute gets lost when applied to the definition of a built-in function (in glibc). The fix is regrettably more invasive than it ought to be. First, don't give special treatment in duplicate_decls to functions that have been explicitly declared just because they're built-in. Second, do not forget that functions are built-in just because they've been defined (assuming compatible signatures). Third, don't ignore builtins in dwarf2out.c (they will get ignored below if they have no definitions, anyway). Last, do not overwrite DECL_FUNCTION_CODE from language- independent code. DECL_ESTIMATED_INSNS turns out to be write-only, so this is no hardship. bootstrapped i686-linux, applied 3.4 branch and shortly to mainline. zw Bug 13856 * c-decl.c (diagnose_mismatched_decls): Only give special treatment when olddecl is DECL_BUILT_IN, if C_DECL_INVISIBLE is also true. (merge_decls): Don't clear DECL_BUILT_IN_CLASS and DECL_FUNCTION_CODE when defining a built-in function. Don't update DECL_ESTIMATED_INSNS. * dwarf2out.c (dwarf2out_decl): Don't ignore built-in FUNCTION_DECLs. * tree.h: Delete DECL_ESTIMATED_INSNS. * tree-inline.c (struct inline_data): Delete inlined_insns field. (expand_call_inline, optimize_inline_calls): Don't update DECL_ESTIMATED_INSNS nor inlined_insns. * cgraphunit.c (cgraph_analyze_function): Don't update DECL_ESTIMATED_INSNS. cp: * optimize.c (maybe_clone_body): Don't update DECL_ESTIMATED_INSNS. * decl.c (duplicate_decls, start_function): Likewise. testsuite: * gcc.dg/visibility-8.c: New testcase. =================================================================== Index: c-decl.c --- c-decl.c 8 Feb 2004 00:52:42 -0000 +++ c-decl.c 8 Feb 2004 01:09:37 -0000 @@ -939,7 +939,8 @@ unless OLDDECL is a builtin. OLDDECL will be discarded in any case. */ if (TREE_CODE (olddecl) != TREE_CODE (newdecl)) { - if (TREE_CODE (olddecl) != FUNCTION_DECL || !DECL_BUILT_IN (olddecl)) + if (TREE_CODE (olddecl) != FUNCTION_DECL + || !DECL_BUILT_IN (olddecl) || !C_DECL_INVISIBLE (olddecl)) { error ("%J'%D' redeclared as different kind of symbol", newdecl, newdecl); @@ -956,7 +957,8 @@ if (!comptypes (oldtype, newtype, COMPARE_STRICT)) { - if (TREE_CODE (olddecl) == FUNCTION_DECL && DECL_BUILT_IN (olddecl)) + if (TREE_CODE (olddecl) == FUNCTION_DECL + && DECL_BUILT_IN (olddecl) && C_DECL_INVISIBLE (olddecl)) { /* Accept harmless mismatch in function types. This is for the ffs and fprintf builtins. */ @@ -1034,6 +1036,7 @@ can't validate the argument list) the built-in definition is overridden, but optionally warn this was a bad choice of name. */ if (DECL_BUILT_IN (olddecl) + && C_DECL_INVISIBLE (olddecl) && (!TREE_PUBLIC (newdecl) || (DECL_INITIAL (newdecl) && !TYPE_ARG_TYPES (TREE_TYPE (newdecl))))) @@ -1428,20 +1431,9 @@ if (DECL_BUILT_IN (olddecl)) { - /* Get rid of any built-in function if we have a function - definition. */ - if (new_is_definition) - { - TREE_TYPE (olddecl) = TREE_TYPE (newdecl); - DECL_BUILT_IN_CLASS (olddecl) = NOT_BUILT_IN; - } - else - { - /* If redeclaring a builtin function, and not a definition, - it stays built in. */ - DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl); - DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl); - } + /* If redeclaring a builtin function, it stays built in. */ + DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl); + DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl); } /* Also preserve various other info from the definition. */ @@ -1451,7 +1443,6 @@ DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl); DECL_SAVED_INSNS (newdecl) = DECL_SAVED_INSNS (olddecl); DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl); - DECL_ESTIMATED_INSNS (newdecl) = DECL_ESTIMATED_INSNS (olddecl); DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl); /* Set DECL_INLINE on the declaration if we've got a body =================================================================== Index: dwarf2out.c --- dwarf2out.c 5 Feb 2004 22:01:33 -0000 1.478.2.3 +++ dwarf2out.c 8 Feb 2004 01:09:38 -0000 @@ -12153,12 +12153,6 @@ dwarf2out_decl (tree decl) return; case FUNCTION_DECL: - /* Ignore this FUNCTION_DECL if it refers to a builtin declaration of a - builtin function. Explicit programmer-supplied declarations of - these same functions should NOT be ignored however. */ - if (DECL_EXTERNAL (decl) && DECL_BUILT_IN (decl)) - return; - /* What we would really like to do here is to filter out all mere file-scope declarations of file-scope functions which are never referenced later within this translation unit (and keep all of ones =================================================================== Index: tree.h --- tree.h 5 Feb 2004 22:01:36 -0000 1.458.2.3 +++ tree.h 8 Feb 2004 01:09:39 -0000 @@ -1627,13 +1627,6 @@ struct tree_type GTY(()) #define DECL_POINTER_ALIAS_SET_KNOWN_P(NODE) \ (DECL_POINTER_ALIAS_SET (NODE) != - 1) -/* In a FUNCTION_DECL for which DECL_BUILT_IN does not hold, this is - the approximate number of statements in this function. There is - no need for this number to be exact; it is only used in various - heuristics regarding optimization. */ -#define DECL_ESTIMATED_INSNS(NODE) \ - (FUNCTION_DECL_CHECK (NODE)->decl.u1.i) - /* Nonzero for a decl which is at file scope. */ #define DECL_FILE_SCOPE_P(EXP) \ (! DECL_CONTEXT (EXP) \ =================================================================== Index: tree-inline.c --- tree-inline.c 23 Jan 2004 23:36:03 -0000 1.90.4.1 +++ tree-inline.c 8 Feb 2004 01:09:39 -0000 @@ -95,9 +95,6 @@ typedef struct inline_data int in_target_cleanup_p; /* A list of the functions current function has inlined. */ varray_type inlined_fns; - /* The approximate number of instructions we have inlined in the - current call stack. */ - int inlined_insns; /* We use the same mechanism to build clones that we do to perform inlining. However, there are a few places where we need to distinguish between those two situations. This flag is true if @@ -1569,11 +1566,6 @@ expand_call_inline (tree *tp, int *walk_ the equivalent inlined version either. */ TREE_USED (*tp) = 1; - /* Our function now has more statements than it did before. */ - DECL_ESTIMATED_INSNS (VARRAY_TREE (id->fns, 0)) += DECL_ESTIMATED_INSNS (fn); - /* For accounting, subtract one for the saved call/ret. */ - id->inlined_insns += DECL_ESTIMATED_INSNS (fn) - 1; - /* Update callgraph if needed. */ if (id->decl) { @@ -1590,11 +1582,6 @@ expand_call_inline (tree *tp, int *walk_ } VARRAY_POP (id->fns); - /* If we've returned to the top level, clear out the record of how - much inlining has been done. */ - if (VARRAY_ACTIVE_SIZE (id->fns) == id->first_inlined_fn) - id->inlined_insns = 0; - /* Don't walk into subtrees. We've already handled them above. */ *walk_subtrees = 0; @@ -1634,9 +1621,6 @@ optimize_inline_calls (tree fn) /* Don't allow recursion into FN. */ VARRAY_TREE_INIT (id.fns, 32, "fns"); VARRAY_PUSH_TREE (id.fns, fn); - if (!DECL_ESTIMATED_INSNS (fn)) - DECL_ESTIMATED_INSNS (fn) - = (*lang_hooks.tree_inlining.estimate_num_insns) (fn); /* Or any functions that aren't finished yet. */ prev_fn = NULL_TREE; if (current_function_decl) =================================================================== Index: cgraphunit.c --- cgraphunit.c 1 Feb 2004 13:01:09 -0000 1.46.2.4 +++ cgraphunit.c 8 Feb 2004 01:09:38 -0000 @@ -327,10 +327,9 @@ cgraph_analyze_function (struct cgraph_n cgraph_create_edges (decl, DECL_SAVED_TREE (decl)); node->local.inlinable = tree_inlinable_function_p (decl); - if (!DECL_ESTIMATED_INSNS (decl)) - DECL_ESTIMATED_INSNS (decl) + if (!node->local.self_insns) + node->local.self_insns = (*lang_hooks.tree_inlining.estimate_num_insns) (decl); - node->local.self_insns = DECL_ESTIMATED_INSNS (decl); if (node->local.inlinable) node->local.disregard_inline_limits = (*lang_hooks.tree_inlining.disregard_inline_limits) (decl); =================================================================== Index: cp/optimize.c --- cp/optimize.c 25 Jan 2004 02:52:32 -0000 1.103.4.1 +++ cp/optimize.c 8 Feb 2004 01:09:39 -0000 @@ -232,10 +232,6 @@ maybe_clone_body (tree fn) /* Clone the body. */ clone_body (clone, fn, decl_map); - /* There are as many statements in the clone as in the - original. */ - DECL_ESTIMATED_INSNS (clone) = DECL_ESTIMATED_INSNS (fn); - /* Clean up. */ splay_tree_delete (decl_map); =================================================================== Index: cp/decl.c --- cp/decl.c 7 Feb 2004 09:43:01 -0000 1.1174.2.7 +++ cp/decl.c 8 Feb 2004 01:09:39 -0000 @@ -1853,8 +1853,6 @@ duplicate_decls (tree newdecl, tree oldd regardless of declaration matches. */ SET_DECL_RTL (newdecl, DECL_RTL (olddecl)); } - else - DECL_ESTIMATED_INSNS (newdecl) = DECL_ESTIMATED_INSNS (olddecl); DECL_RESULT (newdecl) = DECL_RESULT (olddecl); /* Don't clear out the arguments if we're redefining a function. */ @@ -10257,9 +10255,6 @@ start_function (tree declspecs, tree dec /* Start the statement-tree, start the tree now. */ begin_stmt_tree (&DECL_SAVED_TREE (decl1)); - - /* Don't double-count statements in templates. */ - DECL_ESTIMATED_INSNS (decl1) = 0; /* Let the user know we're compiling this function. */ announce_function (decl1); =================================================================== Index: testsuite/gcc.dg/visibility-8.c --- testsuite/gcc.dg/visibility-8.c 1 Jan 1970 00:00:00 -0000 +++ testsuite/gcc.dg/visibility-8.c 8 Feb 2004 01:09:41 -0000 @@ -0,0 +1,16 @@ +/* Test hidden visibility on built-in functions (for libc). PR 13856. */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-assembler "\\.hidden.*__GI_fputs_unlocked" } } */ + +int fputs_unlocked (const char *restrict, int *restrict) + __asm__ ("__GI_fputs_unlocked") + __attribute__ ((visibility ("hidden"))); + +int +fputs_unlocked (str, fp) + const char *str; + int *fp; +{ +} -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/13856] [3.4/3.5 Regression] hidden support broken with builtin functions 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org ` (9 preceding siblings ...) 2004-02-08 1:54 ` zack at codesourcery dot com @ 2004-02-08 1:59 ` cvs-commit at gcc dot gnu dot org 2004-02-08 2:01 ` zack at gcc dot gnu dot org ` (3 subsequent siblings) 14 siblings, 0 replies; 16+ messages in thread From: cvs-commit at gcc dot gnu dot org @ 2004-02-08 1:59 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-02-08 01:59 ------- Subject: Bug 13856 CVSROOT: /cvs/gcc Module name: gcc Changes by: zack@gcc.gnu.org 2004-02-08 01:59:12 Modified files: gcc : ChangeLog c-common.c c-common.h c-decl.c c-opts.c c-parse.in cgraphunit.c dwarf2out.c tree-inline.c tree.h gcc/cp : ChangeLog decl.c name-lookup.c optimize.c parser.c gcc/testsuite : ChangeLog gcc/testsuite/gcc.c-torture/execute: string-opt-15.c gcc/testsuite/gcc.dg: fwritable-strings-1.c Added files: gcc/testsuite/gcc.dg: visibility-8.c Log message: * c-common.c (shadow_warning): Delete. * c-common.h (free_parser_stacks, shadow_warning, sw_kind): Delete. * c-decl.c (warn_if_shadowing): Issue shadow warnings directly. * c-opts.c (c_common_parse_file): Don't call free_parser_stacks. * c-parse.in (free_parser_stacks): Delete. cp: * name-lookup.c (pushdecl): Issue shadow warnings directly. * parser.c (free_parser_stacks): Delete. testsuite: * gcc.c-torture/execute/string-opt-15.c: Define memcmp with void * arguments. * gcc.dg/fwritable-strings-1.c: Expect the deprecation notice. ------ Bug 13856 * c-decl.c (diagnose_mismatched_decls): Only give special treatment when olddecl is DECL_BUILT_IN, if C_DECL_INVISIBLE is also true. (merge_decls): Don't clear DECL_BUILT_IN_CLASS and DECL_FUNCTION_CODE when defining a built-in function. Don't update DECL_ESTIMATED_INSNS. * dwarf2out.c (dwarf2out_decl): Don't ignore built-in FUNCTION_DECLs. * tree.h: Delete DECL_ESTIMATED_INSNS. * tree-inline.c (struct inline_data): Delete inlined_insns field. (expand_call_inline, optimize_inline_calls): Don't update DECL_ESTIMATED_INSNS nor inlined_insns. * cgraphunit.c (cgraph_analyze_function): Don't update DECL_ESTIMATED_INSNS. cp: * optimize.c (maybe_clone_body): Don't update DECL_ESTIMATED_INSNS. * decl.c (duplicate_decls, start_function): Likewise. testsuite: * gcc.dg/visibility-8.c: New testcase. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.2704&r2=2.2705 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&r1=1.480&r2=1.481 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.h.diff?cvsroot=gcc&r1=1.219&r2=1.220 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&r1=1.475&r2=1.476 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-opts.c.diff?cvsroot=gcc&r1=1.100&r2=1.101 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-parse.in.diff?cvsroot=gcc&r1=1.197&r2=1.198 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cgraphunit.c.diff?cvsroot=gcc&r1=1.50&r2=1.51 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&r1=1.491&r2=1.492 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-inline.c.diff?cvsroot=gcc&r1=1.91&r2=1.92 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&r1=1.463&r2=1.464 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3946&r2=1.3947 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1182&r2=1.1183 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.36&r2=1.37 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/optimize.c.diff?cvsroot=gcc&r1=1.104&r2=1.105 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.170&r2=1.171 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3477&r2=1.3478 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/string-opt-15.c.diff?cvsroot=gcc&r1=1.2&r2=1.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/visibility-8.c.diff?cvsroot=gcc&r1=1.1&r2=1.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/fwritable-strings-1.c.diff?cvsroot=gcc&r1=1.1&r2=1.2 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/13856] [3.4/3.5 Regression] hidden support broken with builtin functions 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org ` (10 preceding siblings ...) 2004-02-08 1:59 ` cvs-commit at gcc dot gnu dot org @ 2004-02-08 2:01 ` zack at gcc dot gnu dot org 2004-02-08 6:41 ` aj at suse dot de ` (2 subsequent siblings) 14 siblings, 0 replies; 16+ messages in thread From: zack at gcc dot gnu dot org @ 2004-02-08 2:01 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From zack at gcc dot gnu dot org 2004-02-08 02:01 ------- fixed. -- What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/13856] [3.4/3.5 Regression] hidden support broken with builtin functions 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org ` (11 preceding siblings ...) 2004-02-08 2:01 ` zack at gcc dot gnu dot org @ 2004-02-08 6:41 ` aj at suse dot de 2004-02-08 7:10 ` zack at codesourcery dot com 2004-02-08 7:25 ` gdr at integrable-solutions dot net 14 siblings, 0 replies; 16+ messages in thread From: aj at suse dot de @ 2004-02-08 6:41 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From aj at suse dot de 2004-02-08 06:41 ------- Subject: Re: c-decl.c rewrite: fix bug 13856 "Zack Weinberg" <zack@codesourcery.com> writes: > [...] > Bug 13856 You should use "PR c/13856", so that bugzilla picks it up automatically, Andreas -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/13856] [3.4/3.5 Regression] hidden support broken with builtin functions 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org ` (12 preceding siblings ...) 2004-02-08 6:41 ` aj at suse dot de @ 2004-02-08 7:10 ` zack at codesourcery dot com 2004-02-08 7:25 ` gdr at integrable-solutions dot net 14 siblings, 0 replies; 16+ messages in thread From: zack at codesourcery dot com @ 2004-02-08 7:10 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From zack at codesourcery dot com 2004-02-08 07:10 ------- Subject: Re: c-decl.c rewrite: fix bug 13856 Andreas Jaeger <aj@suse.de> writes: > "Zack Weinberg" <zack@codesourcery.com> writes: > >> [...] >> Bug 13856 > > You should use "PR c/13856", so that bugzilla picks it up > automatically, This notation works too. zw -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/13856] [3.4/3.5 Regression] hidden support broken with builtin functions 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org ` (13 preceding siblings ...) 2004-02-08 7:10 ` zack at codesourcery dot com @ 2004-02-08 7:25 ` gdr at integrable-solutions dot net 14 siblings, 0 replies; 16+ messages in thread From: gdr at integrable-solutions dot net @ 2004-02-08 7:25 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From gdr at integrable-solutions dot net 2004-02-08 07:25 ------- Subject: Re: c-decl.c rewrite: fix bug 13856 "Zack Weinberg" <zack@codesourcery.com> writes: | Andreas Jaeger <aj@suse.de> writes: | | > "Zack Weinberg" <zack@codesourcery.com> writes: | > | >> [...] | >> Bug 13856 | > | > You should use "PR c/13856", so that bugzilla picks it up | > automatically, | | This notation works too. For humans looking at ChangeLog, it makes it easier to mentally caterogize the bug (i.e. middle-end, C, optimization, target) without having to go through bugzilla. -- Gaby -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13856 ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2004-02-08 7:25 UTC | newest] Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-01-25 12:28 [Bug c/13856] New: hidden support broken with builtin functions aj at gcc dot gnu dot org 2004-01-25 12:29 ` [Bug c/13856] " aj at gcc dot gnu dot org 2004-01-25 12:30 ` aj at gcc dot gnu dot org 2004-01-25 15:52 ` [Bug c/13856] [3.4 Regression] " pinskia at gcc dot gnu dot org 2004-01-26 6:30 ` [Bug c/13856] [3.4/3.5 " aj at gcc dot gnu dot org 2004-02-01 13:28 ` pinskia at gcc dot gnu dot org 2004-02-03 20:19 ` uweigand at gcc dot gnu dot org 2004-02-03 20:47 ` uweigand at gcc dot gnu dot org 2004-02-03 21:25 ` zack at gcc dot gnu dot org 2004-02-08 1:52 ` cvs-commit at gcc dot gnu dot org 2004-02-08 1:54 ` zack at codesourcery dot com 2004-02-08 1:59 ` cvs-commit at gcc dot gnu dot org 2004-02-08 2:01 ` zack at gcc dot gnu dot org 2004-02-08 6:41 ` aj at suse dot de 2004-02-08 7:10 ` zack at codesourcery dot com 2004-02-08 7:25 ` gdr at integrable-solutions dot net
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).