public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/29323]  New: set_nothrow_function_flags does invalid analysis on weak functions
@ 2006-10-02 16:05 amylaar at gcc dot gnu dot org
  2006-10-02 16:09 ` [Bug tree-optimization/29323] " amylaar at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2006-10-02 16:05 UTC (permalink / raw)
  To: gcc-bugs

If a function definition is present, except.c:set_nothrow_function_flags marks
functions as nothrow depending on analysis of the function definition.
This is incorrect when the function does not bind locally (compare with
other function analysis in PR tree-optimization/27781).


-- 
           Summary: set_nothrow_function_flags does invalid analysis on weak
                    functions
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: wrong-code, EH
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amylaar at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29323


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

* [Bug tree-optimization/29323] set_nothrow_function_flags does invalid analysis on weak functions
  2006-10-02 16:05 [Bug tree-optimization/29323] New: set_nothrow_function_flags does invalid analysis on weak functions amylaar at gcc dot gnu dot org
@ 2006-10-02 16:09 ` amylaar at gcc dot gnu dot org
  2006-10-02 16:10 ` amylaar at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2006-10-02 16:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from amylaar at gcc dot gnu dot org  2006-10-02 16:09 -------
Created an attachment (id=12370)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12370&action=view)
test case - main file


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29323


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

* [Bug tree-optimization/29323] set_nothrow_function_flags does invalid analysis on weak functions
  2006-10-02 16:05 [Bug tree-optimization/29323] New: set_nothrow_function_flags does invalid analysis on weak functions amylaar at gcc dot gnu dot org
  2006-10-02 16:09 ` [Bug tree-optimization/29323] " amylaar at gcc dot gnu dot org
@ 2006-10-02 16:10 ` amylaar at gcc dot gnu dot org
  2006-10-02 17:07 ` [Bug rtl-optimization/29323] " amylaar at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2006-10-02 16:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from amylaar at gcc dot gnu dot org  2006-10-02 16:10 -------
Created an attachment (id=12371)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12371&action=view)
test case - actual definition of function foo


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29323


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

* [Bug rtl-optimization/29323] set_nothrow_function_flags does invalid analysis on weak functions
  2006-10-02 16:05 [Bug tree-optimization/29323] New: set_nothrow_function_flags does invalid analysis on weak functions amylaar at gcc dot gnu dot org
  2006-10-02 16:09 ` [Bug tree-optimization/29323] " amylaar at gcc dot gnu dot org
  2006-10-02 16:10 ` amylaar at gcc dot gnu dot org
@ 2006-10-02 17:07 ` amylaar at gcc dot gnu dot org
  2006-10-03  5:26 ` [Bug rtl-optimization/29323] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2006-10-02 17:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from amylaar at gcc dot gnu dot org  2006-10-02 17:07 -------
While except.c:set_nothrow_function_flags analyzes rtl, the DECL_NOTHROW flag
it computes is a tree bit.  via calls.c:flags_from_decl_or_type ->
calls.c:call_expr_flags -> tree-eh.c:tree_could_throw_p makes this information
is made available to the tree optimizers.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29323


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

* [Bug rtl-optimization/29323] [4.0/4.1/4.2 Regression] set_nothrow_function_flags does invalid analysis on weak functions
  2006-10-02 16:05 [Bug tree-optimization/29323] New: set_nothrow_function_flags does invalid analysis on weak functions amylaar at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-10-02 17:07 ` [Bug rtl-optimization/29323] " amylaar at gcc dot gnu dot org
@ 2006-10-03  5:26 ` pinskia at gcc dot gnu dot org
  2006-10-09 14:25 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-03  5:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-10-03 05:26 -------
http://gcc.gnu.org/ml/gcc-patches/2000-03/msg00354.html
So this is a regression from 2.95.3.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|4.1.1 4.2.0                 |4.1.1 4.2.0 3.3.3 3.0.4
      Known to work|                            |2.95.3
   Last reconfirmed|0000-00-00 00:00:00         |2006-10-03 05:26:42
               date|                            |
            Summary|set_nothrow_function_flags  |[4.0/4.1/4.2 Regression]
                   |does invalid analysis on    |set_nothrow_function_flags
                   |weak functions              |does invalid analysis on
                   |                            |weak functions
   Target Milestone|---                         |4.0.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29323


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

* [Bug rtl-optimization/29323] [4.0/4.1/4.2 Regression] set_nothrow_function_flags does invalid analysis on weak functions
  2006-10-02 16:05 [Bug tree-optimization/29323] New: set_nothrow_function_flags does invalid analysis on weak functions amylaar at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-10-03  5:26 ` [Bug rtl-optimization/29323] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-10-09 14:25 ` rguenth at gcc dot gnu dot org
  2006-10-09 16:10 ` patchapp at dberlin dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-09 14:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2006-10-09 14:25 -------
The frontend marks foo () TREE_STATIC in start_preparsed_function () and later
TREE_NOTHROW in finish_function () because

  /* If this function can't throw any exceptions, remember that.  */
  if (!processing_template_decl
      && !cp_function_chain->can_throw
      && !flag_non_call_exceptions)
    TREE_NOTHROW (fndecl) = 1;

where cp_function_chain->can_throw is 0 (its initial value(?)).

Fixing that and the RTL problem fixes the testcase.  I am, of course, not
sure if the C++ frontend fix is ok.

Index: except.c
===================================================================
--- except.c    (revision 117569)
+++ except.c    (working copy)
@@ -2787,6 +2787,9 @@ set_nothrow_function_flags (void)
 {
   rtx insn;

+  if (!targetm.binds_local_p (current_function_decl))
+    return 0;
+
   TREE_NOTHROW (current_function_decl) = 1;

   /* Assume cfun->all_throwers_are_sibcalls until we encounter
Index: cp/decl.c
===================================================================
--- cp/decl.c   (revision 117569)
+++ cp/decl.c   (working copy)
@@ -11081,7 +11081,8 @@ finish_function (int flags)
   /* If this function can't throw any exceptions, remember that.  */
   if (!processing_template_decl
       && !cp_function_chain->can_throw
-      && !flag_non_call_exceptions)
+      && !flag_non_call_exceptions
+      && targetm.binds_local_p (fndecl))
     TREE_NOTHROW (fndecl) = 1;

   /* This must come after expand_function_end because cleanups might


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-10-03 05:26:42         |2006-10-09 14:25:36
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29323


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

* [Bug rtl-optimization/29323] [4.0/4.1/4.2 Regression] set_nothrow_function_flags does invalid analysis on weak functions
  2006-10-02 16:05 [Bug tree-optimization/29323] New: set_nothrow_function_flags does invalid analysis on weak functions amylaar at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-10-09 14:25 ` rguenth at gcc dot gnu dot org
@ 2006-10-09 16:10 ` patchapp at dberlin dot org
  2006-10-10  8:27 ` [Bug rtl-optimization/29323] [4.0/4.1 " rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: patchapp at dberlin dot org @ 2006-10-09 16:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from patchapp at dberlin dot org  2006-10-09 16:10 -------
Subject: Bug number PR29323

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00458.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29323


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

* [Bug rtl-optimization/29323] [4.0/4.1 Regression] set_nothrow_function_flags does invalid analysis on weak functions
  2006-10-02 16:05 [Bug tree-optimization/29323] New: set_nothrow_function_flags does invalid analysis on weak functions amylaar at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2006-10-09 16:10 ` patchapp at dberlin dot org
@ 2006-10-10  8:27 ` rguenth at gcc dot gnu dot org
  2006-10-10  8:27 ` [Bug rtl-optimization/29323] [4.0/4.1/4.2 " rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-10  8:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2006-10-10 08:27 -------
Fixed on the mainline.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.0/4.1/4.2 Regression]    |[4.0/4.1 Regression]
                   |set_nothrow_function_flags  |set_nothrow_function_flags
                   |does invalid analysis on    |does invalid analysis on
                   |weak functions              |weak functions


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29323


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

* [Bug rtl-optimization/29323] [4.0/4.1/4.2 Regression] set_nothrow_function_flags does invalid analysis on weak functions
  2006-10-02 16:05 [Bug tree-optimization/29323] New: set_nothrow_function_flags does invalid analysis on weak functions amylaar at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2006-10-10  8:27 ` [Bug rtl-optimization/29323] [4.0/4.1 " rguenth at gcc dot gnu dot org
@ 2006-10-10  8:27 ` rguenth at gcc dot gnu dot org
  2006-10-14  9:14 ` [Bug rtl-optimization/29323] [4.0 " rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-10  8:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2006-10-10 08:27 -------
Subject: Bug 29323

Author: rguenth
Date: Tue Oct 10 08:27:02 2006
New Revision: 117598

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117598
Log:
2006-10-10  Richard Guenther  <rguenther@suse.de>

        PR rtl-optimization/29323
        * except.c (set_nothrow_function_flags): For functions
        that do not bind local bail out early.

        * decl.c (finish_function): Set TREE_NOTHROW only for
        functions that bind local.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/except.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29323


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

* [Bug rtl-optimization/29323] [4.0 Regression] set_nothrow_function_flags does invalid analysis on weak functions
  2006-10-02 16:05 [Bug tree-optimization/29323] New: set_nothrow_function_flags does invalid analysis on weak functions amylaar at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2006-10-10  8:27 ` [Bug rtl-optimization/29323] [4.0/4.1/4.2 " rguenth at gcc dot gnu dot org
@ 2006-10-14  9:14 ` rguenth at gcc dot gnu dot org
  2006-10-14  9:14 ` [Bug rtl-optimization/29323] [4.0/4.1 " rguenth at gcc dot gnu dot org
  2007-02-03 20:30 ` [Bug rtl-optimization/29323] [4.0 " gdr at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-14  9:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rguenth at gcc dot gnu dot org  2006-10-14 09:14 -------
Fixed for 4.1.2.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
         AssignedTo|rguenth at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW
            Summary|[4.0/4.1 Regression]        |[4.0 Regression]
                   |set_nothrow_function_flags  |set_nothrow_function_flags
                   |does invalid analysis on    |does invalid analysis on
                   |weak functions              |weak functions


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29323


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

* [Bug rtl-optimization/29323] [4.0/4.1 Regression] set_nothrow_function_flags does invalid analysis on weak functions
  2006-10-02 16:05 [Bug tree-optimization/29323] New: set_nothrow_function_flags does invalid analysis on weak functions amylaar at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2006-10-14  9:14 ` [Bug rtl-optimization/29323] [4.0 " rguenth at gcc dot gnu dot org
@ 2006-10-14  9:14 ` rguenth at gcc dot gnu dot org
  2007-02-03 20:30 ` [Bug rtl-optimization/29323] [4.0 " gdr at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-14  9:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from rguenth at gcc dot gnu dot org  2006-10-14 09:13 -------
Subject: Bug 29323

Author: rguenth
Date: Sat Oct 14 09:13:43 2006
New Revision: 117727

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117727
Log:
2006-10-14  Richard Guenther  <rguenther@suse.de>

        PR rtl-optimization/29323
        * except.c (set_nothrow_function_flags): For functions
        that do not bind local bail out early.

        * decl.c (finish_function): Set TREE_NOTHROW only for
        functions that bind local.

Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/decl.c
    branches/gcc-4_1-branch/gcc/except.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29323


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

* [Bug rtl-optimization/29323] [4.0 Regression] set_nothrow_function_flags does invalid analysis on weak functions
  2006-10-02 16:05 [Bug tree-optimization/29323] New: set_nothrow_function_flags does invalid analysis on weak functions amylaar at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2006-10-14  9:14 ` [Bug rtl-optimization/29323] [4.0/4.1 " rguenth at gcc dot gnu dot org
@ 2007-02-03 20:30 ` gdr at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at gcc dot gnu dot org @ 2007-02-03 20:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from gdr at gcc dot gnu dot org  2007-02-03 20:30 -------
Fixed in GCC-4.1.2.


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.0.4                       |4.1.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29323


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

end of thread, other threads:[~2007-02-03 20:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-02 16:05 [Bug tree-optimization/29323] New: set_nothrow_function_flags does invalid analysis on weak functions amylaar at gcc dot gnu dot org
2006-10-02 16:09 ` [Bug tree-optimization/29323] " amylaar at gcc dot gnu dot org
2006-10-02 16:10 ` amylaar at gcc dot gnu dot org
2006-10-02 17:07 ` [Bug rtl-optimization/29323] " amylaar at gcc dot gnu dot org
2006-10-03  5:26 ` [Bug rtl-optimization/29323] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
2006-10-09 14:25 ` rguenth at gcc dot gnu dot org
2006-10-09 16:10 ` patchapp at dberlin dot org
2006-10-10  8:27 ` [Bug rtl-optimization/29323] [4.0/4.1 " rguenth at gcc dot gnu dot org
2006-10-10  8:27 ` [Bug rtl-optimization/29323] [4.0/4.1/4.2 " rguenth at gcc dot gnu dot org
2006-10-14  9:14 ` [Bug rtl-optimization/29323] [4.0 " rguenth at gcc dot gnu dot org
2006-10-14  9:14 ` [Bug rtl-optimization/29323] [4.0/4.1 " rguenth at gcc dot gnu dot org
2007-02-03 20:30 ` [Bug rtl-optimization/29323] [4.0 " gdr at gcc dot gnu dot org

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