public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2
@ 2010-10-03 23:56 nicola at gcc dot gnu.org
  2010-10-04  7:32 ` [Bug objc/45878] [4.6 Regression] " iains at gcc dot gnu.org
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: nicola at gcc dot gnu.org @ 2010-10-03 23:56 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Can't compile even a trivial ObjC program with
                    -fexceptions -O2
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: objc
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: nicola@gcc.gnu.org


Created attachment 21953
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=21953
Test case that does not compile with -fexceptions -O2

The following testcase:

#import <objc/objc.h>
#import <objc/NXConstStr.h>

void function (void)
{
  if ([@"strings" isEqual: nil])
    {
      ;
    }
}

fails to compile if you compile it with -O2 -fexceptions.

gcc gimple_call.m -lobjc -c -O2 -fexceptions
gimple_call.m: In function ‘function’:
gimple_call.m:10:1: error: invalid conversion in gimple call
BOOL

struct objc_object *

# .MEM_7 = VDEF <.MEM_6>
D.3351_3 = D.3350_1 (&_OBJC_INSTANCE_0, &_OBJC_SELECTOR_TABLE, 0B);

gimple_call.m:10:1: internal compiler error: verify_stmts failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Thanks


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
@ 2010-10-04  7:32 ` iains at gcc dot gnu.org
  2010-10-04  9:25 ` iains at gcc dot gnu.org
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: iains at gcc dot gnu.org @ 2010-10-04  7:32 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.10.04 07:32:12
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |iains at gcc dot gnu.org
            Summary|Can't compile even a        |[4.6 Regression] Can't
                   |trivial ObjC program with   |compile even a trivial ObjC
                   |-fexceptions -O2            |program with -fexceptions
                   |                            |-O2
     Ever Confirmed|0                           |1

--- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> 2010-10-04 07:32:12 UTC ---
the change was:
http://gcc.gnu.org/ml/gcc-cvs/2010-10/msg00090.html

this also applies to any method call compiled with -fnext-runtime  -O > 0.

I looked at the gimple out from a trivial program at O0 and O1 and didn't see
any material difference around the call construction - which implies that this
is not an optimization problem, but simply that the check doesn't get exercised
at O0).

The code in question is gcc/objc/objc-act.c:6645-6722 

It seems that, although we think we cast the function type in
build_method_call, something is not working (or perhaps the type information is
not set properly elsewhere).

 cc-ing Honza in case he has some ideas :-) ... 
.. (I discussed on irc with him and we came to the initial conclusion that this
is prob. a FE problem).


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
  2010-10-04  7:32 ` [Bug objc/45878] [4.6 Regression] " iains at gcc dot gnu.org
@ 2010-10-04  9:25 ` iains at gcc dot gnu.org
  2010-10-04 10:12 ` rguenth at gcc dot gnu.org
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: iains at gcc dot gnu.org @ 2010-10-04  9:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> 2010-10-04 09:25:18 UTC ---
hm,  I made a very simple root object like this [omitting the cruft to declare
the types & routines for both NeXT and GNU runtimes].

----
@interface myRootObject {
@public
  Class isa;
  int var;
}

+ (id) initialize;
+(Class) class;
+ (id) alloc ;

- (id) init;
- (int) var;
@end

@implementation myRootObject

+initialize { return self;}
+(Class)class { return object_get_class(self);}
+ (id) alloc { return class_create_instance(self);}

- (id) init {return self;}
- (int) var {return var;}
@end

int main ()
{
  myRootObject *r = [[myRootObject alloc] init];
  r->var = 1;

  return [r var];
}

----
All is OK until we hit the [r var] line - which fails with the gimple int !=
struct objc_class * error.

however, stepping through the code  in build_objc_method_call() ... seems to
show that the cast is correctly installed.....

Breakpoint 4, build_objc_method_call (loc=33157, super_flag=0,
method_prototype=0x41aa7bd0, lookup_object=0x41abe16c, selector=0x41ababa0,
method_params=0x41abc360) at /GCC/gcc-live-trunk/gcc/objc/objc-act.c:6719
6719      t = build3 (OBJ_TYPE_REF, sender_cast, method, lookup_object,
size_zero_node);
(gdb) call debug_tree(sender_cast)
 <pointer_type 0x41abac60
    type <function_type 0x41abac00
        type <integer_type 0x41a192a0 int asm_written public SI
            size <integer_cst 0x41a05380 constant 32>
            unit size <integer_cst 0x41a05120 constant 4>
            align 32 symtab 1101764720 alias set -1 canonical type 0x41a192a0
precision 32 min <integer_cst 0x41a05320 -2147483648> max <integer_cst
0x41a05340 2147483647>
            pointer_to_this <pointer_type 0x41a19c00>>
        QI
        size <integer_cst 0x41a051c0 constant 8>
        unit size <integer_cst 0x41a051e0 constant 1>
        align 8 symtab 0 alias set -1 canonical type 0x41abac00
        arg-types <tree_list 0x41abc318 value <pointer_type 0x41aa2780 id>
            chain <tree_list 0x41abc330 value <pointer_type 0x41aa2960>
                chain <tree_list 0x41a15090 value <void_type 0x41a19840
void>>>>
        pointer_to_this <pointer_type 0x41abac60>>
    unsigned SI size <integer_cst 0x41a05380 32> unit size <integer_cst
0x41a05120 4>
    align 32 symtab 0 alias set -1 canonical type 0x41abac60>
(gdb) call debug_tree(method)     
 <addr_expr 0x41abe188
    type <pointer_type 0x41abaa80
        type <function_type 0x41aa2cc0 type <pointer_type 0x41aa2780 id>
            QI
            size <integer_cst 0x41a051c0 constant 8>
            unit size <integer_cst 0x41a051e0 constant 1>
            align 8 symtab 0 alias set -1 canonical type 0x41aa2cc0
            arg-types <tree_list 0x41aa40a8 value <pointer_type 0x41aa2780 id>
                chain <tree_list 0x41aa40c0 value <pointer_type 0x41aa2960>>>
            pointer_to_this <pointer_type 0x41abaa80>>
        unsigned SI
        size <integer_cst 0x41a05380 constant 32>
        unit size <integer_cst 0x41a05120 constant 4>
        align 32 symtab 0 alias set -1 canonical type 0x41abaa80>
    constant
    arg 0 <function_decl 0x41aa3b80 objc_msgSend type <function_type
0x41aa2cc0>
        public external decl_6 QI file <built-in> line 0 col 0 align 8>
    ../tests/root-simple.m:93:3>
(gdb) call debug_tree(lookup_object)
 <save_expr 0x41abe16c
    type <pointer_type 0x41aa2780 id
        type <record_type 0x41aa26c0 objc_object VOID
            align 8 symtab 0 alias set -1 canonical type 0x41aa26c0
            pointer_to_this <pointer_type 0x41aa2780 id> chain <type_decl
0x41a20e58 D.1555>>
        unsigned SI
        size <integer_cst 0x41a05380 constant 32>
        unit size <integer_cst 0x41a05120 constant 4>
        align 32 symtab 0 alias set -1 canonical type 0x41aa2780
        pointer_to_this <pointer_type 0x41aa9600>>
    side-effects
    arg 0 <nop_expr 0x41abe150 type <pointer_type 0x41aa2780 id>

        arg 0 <var_decl 0x41aba8a0 r type <pointer_type 0x41aba420>
            used unsigned SI file ../tests/root-simple.m line 90 col 17 size
<integer_cst 0x41a05380 32> unit size <integer_cst 0x41a05120 4>
            align 32 context <function_decl 0x41abb180 main> initial <nop_expr
0x41abe0e0>>>>
(gdb) next


6720      return build_function_call (loc,
(gdb) call debug_tree(t)
 <obj_type_ref 0x41a0f9b4
    type <pointer_type 0x41abac60
        type <function_type 0x41abac00 type <integer_type 0x41a192a0 int>
            QI
            size <integer_cst 0x41a051c0 constant 8>
            unit size <integer_cst 0x41a051e0 constant 1>
            align 8 symtab 0 alias set -1 canonical type 0x41abac00
            arg-types <tree_list 0x41abc318 value <pointer_type 0x41aa2780 id>
                chain <tree_list 0x41abc330 value <pointer_type 0x41aa2960>
                    chain <tree_list 0x41a15090 value <void_type 0x41a19840
void>>>>
            pointer_to_this <pointer_type 0x41abac60>>
        unsigned SI
        size <integer_cst 0x41a05380 constant 32>
        unit size <integer_cst 0x41a05120 constant 4>
        align 32 symtab 0 alias set -1 canonical type 0x41abac60>
    side-effects
    arg 0 <addr_expr 0x41abe188
        type <pointer_type 0x41abaa80 type <function_type 0x41aa2cc0>
            unsigned SI size <integer_cst 0x41a05380 32> unit size <integer_cst
0x41a05120 4>
            align 32 symtab 0 alias set -1 canonical type 0x41abaa80>
        constant
        arg 0 <function_decl 0x41aa3b80 objc_msgSend type <function_type
0x41aa2cc0>
            public external decl_6 QI file <built-in> line 0 col 0 align 8>
        ../tests/root-simple.m:93:3>
    arg 1 <save_expr 0x41abe16c
        type <pointer_type 0x41aa2780 id type <record_type 0x41aa26c0
objc_object>
            unsigned SI size <integer_cst 0x41a05380 32> unit size <integer_cst
0x41a05120 4>
            align 32 symtab 0 alias set -1 canonical type 0x41aa2780
            pointer_to_this <pointer_type 0x41aa9600>>
        side-effects
        arg 0 <nop_expr 0x41abe150 type <pointer_type 0x41aa2780 id>
            arg 0 <var_decl 0x41aba8a0 r>>>
    arg 2 <integer_cst 0x41a05140 type <integer_type 0x41a19000 long unsigned
int> constant 0>>
(gdb) 

after the function build:

(gdb) call debug_tree(retval)
 <call_expr 0x4141f580
    type <integer_type 0x41a192a0 int asm_written public SI
        size <integer_cst 0x41a05380 constant 32>
        unit size <integer_cst 0x41a05120 constant 4>
        align 32 symtab 1101764720 alias set -1 canonical type 0x41a192a0
precision 32 min <integer_cst 0x41a05320 -2147483648> max <integer_cst
0x41a05340 2147483647>
        pointer_to_this <pointer_type 0x41a19c00>>
    side-effects
    fn <obj_type_ref 0x41a0f9b4
        type <pointer_type 0x41abac60 type <function_type 0x41abac00>
            unsigned SI size <integer_cst 0x41a05380 32> unit size <integer_cst
0x41a05120 4>
            align 32 symtab 0 alias set -1 canonical type 0x41abac60>
        side-effects
        arg 0 <addr_expr 0x41abe188 type <pointer_type 0x41abaa80>
            constant arg 0 <function_decl 0x41aa3b80 objc_msgSend>
            ../tests/root-simple.m:93:3>
        arg 1 <save_expr 0x41abe16c type <pointer_type 0x41aa2780 id>
            side-effects
            arg 0 <nop_expr 0x41abe150 type <pointer_type 0x41aa2780 id>
                arg 0 <var_decl 0x41aba8a0 r>>>
        arg 2 <integer_cst 0x41a05140 constant 0>> arg 0 <save_expr 0x41abe16c>
    arg 1 <var_decl 0x41ababa0 _OBJC_SELECTOR_REFERENCES_2
        type <pointer_type 0x41aa2960 type <record_type 0x41aa2900
objc_selector>
            unsigned SI size <integer_cst 0x41a05380 32> unit size <integer_cst
0x41a05120 4>
            align 32 symtab 0 alias set -1 canonical type 0x41aa2960>
        static unsigned ignored SI file ../tests/root-simple.m line 93 col 3
size <integer_cst 0x41a05380 32> unit size <integer_cst 0x41a05120 4>
        align 32 initial <error_mark 0x41a0b890>>
    ../tests/root-simple.m:93:3>

(gdb) call debug_tree(0x41abac00)
 <function_type 0x41abac00
    type <integer_type 0x41a192a0 int asm_written public SI
        size <integer_cst 0x41a05380 constant 32>
        unit size <integer_cst 0x41a05120 constant 4>
        align 32 symtab 1101764720 alias set -1 canonical type 0x41a192a0
precision 32 min <integer_cst 0x41a05320 -2147483648> max <integer_cst
0x41a05340 2147483647>
        pointer_to_this <pointer_type 0x41a19c00>>
    QI
    size <integer_cst 0x41a051c0 type <integer_type 0x41a19060 bit_size_type>
constant 8>
    unit size <integer_cst 0x41a051e0 type <integer_type 0x41a19000 long
unsigned int> constant 1>
    align 8 symtab 0 alias set -1 canonical type 0x41abac00
    arg-types <tree_list 0x41abc318
        value <pointer_type 0x41aa2780 id type <record_type 0x41aa26c0
objc_object>
            unsigned SI size <integer_cst 0x41a05380 32> unit size <integer_cst
0x41a05120 4>
            align 32 symtab 0 alias set -1 canonical type 0x41aa2780
            pointer_to_this <pointer_type 0x41aa9600>>
        chain <tree_list 0x41abc330 value <pointer_type 0x41aa2960>
            chain <tree_list 0x41a15090 value <void_type 0x41a19840 void>>>>
    pointer_to_this <pointer_type 0x41abac60>>


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
  2010-10-04  7:32 ` [Bug objc/45878] [4.6 Regression] " iains at gcc dot gnu.org
  2010-10-04  9:25 ` iains at gcc dot gnu.org
@ 2010-10-04 10:12 ` rguenth at gcc dot gnu.org
  2010-10-12 16:03 ` iains at gcc dot gnu.org
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-10-04 10:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-04 10:12:17 UTC ---
Well, what happens is that ObjC (not necessarily incorrectly) assumes that
an OBJ_TYPE_REF acts as a function type conversion.  Folding OTOH simply
replaces the called function with an indirect call (most probably due to
my fix for the segfault - we might want to keep the obj-type-ref untouched
instead) without re-instantiating the original type of the called function.

It is still on my (long) TODO list to make the function type of the called
function in a call explicit (and thus not rely on typing of pointers or
decls that eventually get propagated from some weird place).  Until then
function type conversions are not useless and thus need to be preserved
when doing obj-type-ref folding.


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2010-10-04 10:12 ` rguenth at gcc dot gnu.org
@ 2010-10-12 16:03 ` iains at gcc dot gnu.org
  2010-10-12 16:38 ` mrs at gcc dot gnu.org
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: iains at gcc dot gnu.org @ 2010-10-12 16:03 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrs at gcc dot gnu.org

--- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> 2010-10-12 16:03:19 UTC ---
As I understand things, we need objc_msg_send to be able to masquerade as the
method function it proxies.  Thus it must be cast to the appropriate return
type.

If anyone believes that there's a work-around for this in the FE(s) then could
they post sth here -- otherwise I propose that we re-classify this as a ME bug.

At present, we're having to work on NeXT with r164908 backed out - or there's a
huge amount of ObjC* test-suite noise.


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2010-10-12 16:03 ` iains at gcc dot gnu.org
@ 2010-10-12 16:38 ` mrs at gcc dot gnu.org
  2010-10-12 16:40 ` mrs at gcc dot gnu.org
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mrs at gcc dot gnu.org @ 2010-10-12 16:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from mrs at gcc dot gnu.org <mrs at gcc dot gnu.org> 2010-10-12 16:38:16 UTC ---
I think the patch that broke this should be backed out until the semantics are
sorted out.  I think the middle-end people should decide on which part of the
compiler is wrong, how to make the other-side conform and then change the
documentation to make it clear.  Once that is done, the side that is wrong
should be fixed, once that is done, the patch can then be reenabled.

So far, it sounds like a ME problem to me.


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2010-10-12 16:38 ` mrs at gcc dot gnu.org
@ 2010-10-12 16:40 ` mrs at gcc dot gnu.org
  2010-10-13 13:55 ` rguenth at gcc dot gnu.org
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mrs at gcc dot gnu.org @ 2010-10-12 16:40 UTC (permalink / raw)
  To: gcc-bugs

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

mrs@gcc.gnu.org <mrs at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2010-10-12 16:40 ` mrs at gcc dot gnu.org
@ 2010-10-13 13:55 ` rguenth at gcc dot gnu.org
  2010-10-13 14:26 ` iains at gcc dot gnu.org
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-10-13 13:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-13 13:54:54 UTC ---
(In reply to comment #5)
> I think the patch that broke this should be backed out until the semantics are
> sorted out.  I think the middle-end people should decide on which part of the
> compiler is wrong, how to make the other-side conform and then change the
> documentation to make it clear.  Once that is done, the side that is wrong
> should be fixed, once that is done, the patch can then be reenabled.
> 
> So far, it sounds like a ME problem to me.

It is likely a miscommunication (or lack of definition) on what the middle-end
expects from an OBJ_TYPE_REF and what the ObjC frontend uses it for or how
it does that.

The CCP folding piece looks overly simple to me, it should use the
fold-stmt machinery:

Index: tree-ssa-ccp.c
===================================================================
--- tree-ssa-ccp.c      (revision 165419)
+++ tree-ssa-ccp.c      (working copy)
@@ -2267,6 +2284,7 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi
        tree lhs = gimple_call_lhs (stmt);
        tree val;
        tree argt;
+       tree callee;
        bool changed = false;
        unsigned i;

@@ -2306,16 +2324,24 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi
                changed = true;
              }
          }
-       if (TREE_CODE (gimple_call_fn (stmt)) == OBJ_TYPE_REF)
+
+       callee = gimple_call_fn (stmt);
+       if (TREE_CODE (callee) == OBJ_TYPE_REF
+           && TREE_CODE (OBJ_TYPE_REF_EXPR (callee)) == SSA_NAME)
          {
-           tree expr = OBJ_TYPE_REF_EXPR (gimple_call_fn (stmt));
-           expr = valueize_op (expr);
-           if (TREE_CODE (expr) == ADDR_EXPR
-               && TREE_CODE (TREE_OPERAND (expr, 0)) == FUNCTION_DECL)
-            {
-              gimple_call_set_fn (stmt, expr);
-              changed = true;
-            }
+           tree expr = OBJ_TYPE_REF_EXPR (callee);
+           OBJ_TYPE_REF_EXPR (callee) = valueize_op (expr);
+           if (TREE_CODE (OBJ_TYPE_REF_EXPR (callee)) == ADDR_EXPR)
+             {
+               tree t;
+               t = gimple_fold_obj_type_ref (callee, NULL_TREE);
+               if (t)
+                 {
+                   gimple_call_set_fn (stmt, t);
+                   changed = true;
+                 }
+             }
+           OBJ_TYPE_REF_EXPR (callee) = expr;
          }

        return changed;


but as my ObjC/ObjC++ results on Linux are clean I can't see any issue
with testing.  Hmm?


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2010-10-13 13:55 ` rguenth at gcc dot gnu.org
@ 2010-10-13 14:26 ` iains at gcc dot gnu.org
  2010-10-13 15:05 ` nicola at gcc dot gnu.org
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: iains at gcc dot gnu.org @ 2010-10-13 14:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Iain Sandoe <iains at gcc dot gnu.org> 2010-10-13 14:25:57 UTC ---
(In reply to comment #6)
> (In reply to comment #5)

thanks for the patch ... 

> It is likely a miscommunication (or lack of definition) on what the middle-end
> expects from an OBJ_TYPE_REF and what the ObjC frontend uses it for or how
> it does that.

What should be amended to make this clear?
(I have no recollection of seeing any definition in the ObjC code, or
elsewhere).

> The CCP folding piece looks overly simple to me, it should use the
> fold-stmt machinery:
> 
> Index: tree-ssa-ccp.c

... the patch seems to solve the problem on NeXT (from a stage3-bubble, will
set a full regstrap going shortly)

> but as my ObjC/ObjC++ results on Linux are clean I can't see any issue
> with testing.  Hmm?

Nicola, is there any way of extracting something from GNUStep that would show
this on linux?
 - to use as a testcase.


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2010-10-13 14:26 ` iains at gcc dot gnu.org
@ 2010-10-13 15:05 ` nicola at gcc dot gnu.org
  2010-10-13 15:16 ` dominiq at lps dot ens.fr
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: nicola at gcc dot gnu.org @ 2010-10-13 15:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Nicola Pero <nicola at gcc dot gnu.org> 2010-10-13 15:05:13 UTC ---
Yes, I have already extracted a testcase from GNUstep - it's in the first
comment in the issue. :-)

On my Linux i386, that (valid) piece of code fails to compile with 'internal
compiler error'.  So, Richard could test his patch with it and see if it
improves compiling that testcase.

I'll test it on my machine, but that may take a hour or so as I'm on a
temporary, slow laptop.  I'll post results once I have them. :-)

Thanks


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2010-10-13 15:05 ` nicola at gcc dot gnu.org
@ 2010-10-13 15:16 ` dominiq at lps dot ens.fr
  2010-10-13 15:27 ` iains at gcc dot gnu.org
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: dominiq at lps dot ens.fr @ 2010-10-13 15:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2010-10-13 15:16:39 UTC ---
With the patch in comment #6 and revision 164908, I get the same results as
with revision 164908 reverted on powerpc-apple-darwin9:

                === objc Summary for unix/-m64 ===

# of expected passes            2924
# of unexpected failures        6
# of unexpected successes       7
# of expected failures          54
# of unresolved testcases       2
# of unsupported tests          40

                === objc Summary ===

# of expected passes            7142
# of unexpected failures        37
# of unexpected successes       7
# of expected failures          71
# of unresolved testcases       4
# of unsupported tests          73


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2010-10-13 15:16 ` dominiq at lps dot ens.fr
@ 2010-10-13 15:27 ` iains at gcc dot gnu.org
  2010-10-13 15:44 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: iains at gcc dot gnu.org @ 2010-10-13 15:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Iain Sandoe <iains at gcc dot gnu.org> 2010-10-13 15:27:09 UTC ---
(In reply to comment #8)
> Yes, I have already extracted a testcase from GNUstep - it's in the first
> comment in the issue. :-)
> 
> On my Linux i386, that (valid) piece of code fails to compile with 'internal
> compiler error'.  So, Richard could test his patch with it and see if it
> improves compiling that testcase.

hmm. Then there might well be two problems, the test code @ comment #1 

fails to compile with r164908 backed out on i686-darwin9  " -O2  -fgnu-runtime
-fexceptions "

it also fails with the patch @ comment 6.

(which resolves the similar issue across all NeXT calls).


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2010-10-13 15:27 ` iains at gcc dot gnu.org
@ 2010-10-13 15:44 ` rguenth at gcc dot gnu.org
  2010-10-13 16:59 ` nicola at gcc dot gnu.org
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-10-13 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.6.0

--- Comment #11 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-13 15:44:11 UTC ---
I'm testing the patch on linux right now.


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2010-10-13 15:44 ` rguenth at gcc dot gnu.org
@ 2010-10-13 16:59 ` nicola at gcc dot gnu.org
  2010-10-13 18:25 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: nicola at gcc dot gnu.org @ 2010-10-13 16:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Nicola Pero <nicola at gcc dot gnu.org> 2010-10-13 16:58:34 UTC ---
Yes, the testcase still fails for me after applying the patch.

By the way, Richard, thanks a lot for looking into this.  I really appreciate
it :-)

Thanks


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2010-10-13 16:59 ` nicola at gcc dot gnu.org
@ 2010-10-13 18:25 ` rguenth at gcc dot gnu.org
  2010-10-13 18:38 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-10-13 18:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-13 18:25:12 UTC ---
Author: rguenth
Date: Wed Oct 13 18:25:08 2010
New Revision: 165430

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

    PR objc/45878
    * tree-ssa-ccpc (ccp_fold_stmt): Use gimple_fold_obj_type_ref.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-ssa-ccp.c


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2010-10-13 18:25 ` rguenth at gcc dot gnu.org
@ 2010-10-13 18:38 ` rguenth at gcc dot gnu.org
  2010-10-13 18:48 ` nicola at gcc dot gnu.org
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-10-13 18:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-13 18:37:55 UTC ---
Hm, where are objc headers in a build tree?  I can't seem to compile the
original testcase:

/obj/trunk-g/gcc$ ./xgcc -B. -S gimple_call.m
gimple_call.m:1:22: fatal error: objc/objc.h: No such file or directory
compilation terminated.

but on objc/objc.h in gcc/objc/ or i686-pc-linux/libobjc/

Can you provide "preprocessed" source?

The testcase in comment #2 seems to work for me:

/obj/trunk-g/gcc$ ./xgcc -B. -S t.m
t.m: In function '+[myRootObject class]':
t.m:18:17: warning: return makes pointer from integer without a cast
t.m: In function '+[myRootObject alloc]':
t.m:19:16: warning: return makes pointer from integer without a cast


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
                   ` (14 preceding siblings ...)
  2010-10-13 18:38 ` rguenth at gcc dot gnu.org
@ 2010-10-13 18:48 ` nicola at gcc dot gnu.org
  2010-10-13 20:31 ` rguenth at gcc dot gnu.org
  2010-10-13 20:31 ` rguenth at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: nicola at gcc dot gnu.org @ 2010-10-13 18:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Nicola Pero <nicola at gcc dot gnu.org> 2010-10-13 18:47:52 UTC ---
Try the following testcase, which requires no includes:

==============

typedef struct objc_object { Class class_pointer; } *id;
typedef unsigned char  BOOL;

@interface Object
{
  Class isa;
}
- (BOOL)isEqual:anObject;
@end

@interface NXConstantString: Object
{
  char *c_string;
  unsigned int len;
}
@end

void function (void)
{
  if ([@"strings" isEqual: (id)0])
    {
      ;
    }
}

===============

Compile it with

gcc test.m -c -O2 -fexceptions

Thanks


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
                   ` (15 preceding siblings ...)
  2010-10-13 18:48 ` nicola at gcc dot gnu.org
@ 2010-10-13 20:31 ` rguenth at gcc dot gnu.org
  2010-10-13 20:31 ` rguenth at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-10-13 20:31 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #17 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-13 20:30:46 UTC ---
Fixed.


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

* [Bug objc/45878] [4.6 Regression] Can't compile even a trivial ObjC program with -fexceptions -O2
  2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
                   ` (16 preceding siblings ...)
  2010-10-13 20:31 ` rguenth at gcc dot gnu.org
@ 2010-10-13 20:31 ` rguenth at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-10-13 20:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-13 20:30:17 UTC ---
Author: rguenth
Date: Wed Oct 13 20:30:10 2010
New Revision: 165435

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

    PR objc/45878
    * gimple-fold.c (gimple_fold_obj_type_ref): Leave OBJ_TYPE_REFs
    alone if there are no virtual methods.

    * objc.dg/pr45878.m: New testcase.

Added:
    trunk/gcc/testsuite/objc.dg/pr45878.m
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimple-fold.c
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2010-10-13 20:31 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-03 23:56 [Bug objc/45878] New: Can't compile even a trivial ObjC program with -fexceptions -O2 nicola at gcc dot gnu.org
2010-10-04  7:32 ` [Bug objc/45878] [4.6 Regression] " iains at gcc dot gnu.org
2010-10-04  9:25 ` iains at gcc dot gnu.org
2010-10-04 10:12 ` rguenth at gcc dot gnu.org
2010-10-12 16:03 ` iains at gcc dot gnu.org
2010-10-12 16:38 ` mrs at gcc dot gnu.org
2010-10-12 16:40 ` mrs at gcc dot gnu.org
2010-10-13 13:55 ` rguenth at gcc dot gnu.org
2010-10-13 14:26 ` iains at gcc dot gnu.org
2010-10-13 15:05 ` nicola at gcc dot gnu.org
2010-10-13 15:16 ` dominiq at lps dot ens.fr
2010-10-13 15:27 ` iains at gcc dot gnu.org
2010-10-13 15:44 ` rguenth at gcc dot gnu.org
2010-10-13 16:59 ` nicola at gcc dot gnu.org
2010-10-13 18:25 ` rguenth at gcc dot gnu.org
2010-10-13 18:38 ` rguenth at gcc dot gnu.org
2010-10-13 18:48 ` nicola at gcc dot gnu.org
2010-10-13 20:31 ` rguenth at gcc dot gnu.org
2010-10-13 20:31 ` rguenth at gcc dot gnu.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).