[Bug c/25861] [4.2 Regression] tree check fail at c-common.c:2430
--- Comment #12 from pinskia at gcc dot gnu dot org 2006-01-26 14:59 --- Fixed. -- pinskia at gcc dot gnu dot org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25861
[Bug c/25861] [4.2 Regression] tree check fail at c-common.c:2430
--- Comment #11 from pinskia at gcc dot gnu dot org 2006-01-26 14:59 --- Subject: Bug 25861 Author: pinskia Date: Thu Jan 26 14:59:26 2006 New Revision: 110256 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110256 Log: 2006-01-26 Andrew Pinski <[EMAIL PROTECTED]> PR C/25861 * c-common.c (c_common_truthvalue_conversion) : Use a new variable, inner. PARM_DECLs are always non-weak. 2006-01-26 Andrew Pinski <[EMAIL PROTECTED]> PR C/25861 * gcc.c-torture/compile/pr25861.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/compile/pr25861.c Modified: trunk/gcc/ChangeLog trunk/gcc/c-common.c trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25861
[Bug c/25861] [4.2 Regression] tree check fail at c-common.c:2430
--- Comment #10 from pinskia at gcc dot gnu dot org 2006-01-25 20:40 --- Patch posted: http://gcc.gnu.org/ml/gcc-patches/2006-01/msg01762.html -- pinskia at gcc dot gnu dot org changed: What|Removed |Added URL||http://gcc.gnu.org/ml/gcc- ||patches/2006- ||01/msg01762.html Keywords||patch http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25861
[Bug c/25861] [4.2 Regression] tree check fail at c-common.c:2430
--- Comment #9 from pinskia at gcc dot gnu dot org 2006-01-24 16:16 --- The full patch (with some cleanup) is: Index: c-common.c === --- c-common.c (revision 110173) +++ c-common.c (working copy) @@ -2456,25 +2456,26 @@ c_common_truthvalue_conversion (tree exp case ADDR_EXPR: { - if (DECL_P (TREE_OPERAND (expr, 0)) - && !DECL_WEAK (TREE_OPERAND (expr, 0))) + tree inner = TREE_OPERAND (expr, 0); + if (DECL_P (inner) + && (TREE_CODE (inner) == PARM_DECL || !DECL_WEAK (inner))) { /* Common Ada/Pascal programmer's mistake. We always warn about this since it is so bad. */ warning (OPT_Walways_true, "the address of %qD, will always evaluate as %", -TREE_OPERAND (expr, 0)); +inner); return truthvalue_true_node; } /* If we are taking the address of an external decl, it might be zero if it is weak, so we cannot optimize. */ - if (DECL_P (TREE_OPERAND (expr, 0)) - && DECL_EXTERNAL (TREE_OPERAND (expr, 0))) + if (DECL_P (inner) + && DECL_EXTERNAL (inner)) break; - if (TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 0))) + if (TREE_SIDE_EFFECTS (inner)) return build2 (COMPOUND_EXPR, truthvalue_type_node, -TREE_OPERAND (expr, 0), truthvalue_true_node); +inner, truthvalue_true_node); else return truthvalue_true_node; } I am testing this right now. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25861
[Bug c/25861] [4.2 Regression] tree check fail at c-common.c:2430
--- Comment #8 from pinskia at gcc dot gnu dot org 2006-01-23 19:17 --- This is easy to fix. -- pinskia at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25861
[Bug c/25861] [4.2 Regression] tree check fail at c-common.c:2430
--- Comment #7 from pinskia at gcc dot gnu dot org 2006-01-19 20:20 --- Caused by: 2005-12-14 Ben Elliston <[EMAIL PROTECTED]> * c-common.c (c_common_truthvalue_conversion): Generalise warning for addresses converted to booleans; not just function addresses. * c-typeck.c (build_binary_op): Warn for address comparisons which can never be NULL (eg. func == NULL or &var == NULL). * common.opt (Walways-true): New option. * c-opts.c (c_common_handle_option): Set it with -Wall. * doc/invoke.texi: Document it. -- pinskia at gcc dot gnu dot org changed: What|Removed |Added CC||bje at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25861
[Bug c/25861] [4.2 Regression] tree check fail at c-common.c:2430
--- Comment #6 from pinskia at gcc dot gnu dot org 2006-01-19 20:18 --- Reduced C testcase: int f(void *a) { return !(&a); } -- pinskia at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Component|c++ |c Ever Confirmed|0 |1 GCC host triplet|x86_64-suse-linux | Keywords||ice-on-valid-code Last reconfirmed|-00-00 00:00:00 |2006-01-19 20:18:57 date|| Summary|tree check fail at c- |[4.2 Regression] tree check |common.c:2430 |fail at c-common.c:2430 Target Milestone|--- |4.2.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25861