This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

attribute((mode)) pointers broken by STRIP_USELESS_TYPE_CONVERSION


Hello,

using the __attribute__ ((mode)) feature to declare pointer variables
of non-ptr_mode mode appears to have been broken by tree-ssa.

The following simple test case (on s390x):

struct test;
typedef struct test * __attribute__ ((mode (SI))) test_ptr32;
typedef struct test * test_ptr64;

int
test (test_ptr32 a, test_ptr64 b)
{
  return a == b;
}

aborts in copy_to_mode_reg (explow.c:635) because the tree optimizers
have optimized away the type conversion inserted by the front end,
and pass a direct comparison between different modes to the expander.

It appears that STRIP_USELESS_TYPE_CONVERSION simply removes the
NOP_EXPR generated by the front end:

 <nop_expr 0x20000291000
    type <pointer_type 0x20000286c40
        type <record_type 0x20000286a80 test VOID
            align 8 symtab 0 alias set -1
            pointer_to_this <pointer_type 0x20000286d20> chain <type_decl 0x20000286b60>>
        unsigned DI
        size <integer_cst 0x200001bc990 constant invariant 64>
        unit size <integer_cst 0x200001bc9c0 constant invariant 8>
        align 64 symtab 0 alias set -1>

    arg 0 <parm_decl 0x200002901c0 a
        type <pointer_type 0x20000286ee0 test_ptr32 type <record_type 0x20000286a80 test>
            unsigned SI
            size <integer_cst 0x200001bc780 constant invariant 32>
            unit size <integer_cst 0x200001bc1e0 constant invariant 4>
            align 32 symtab 0 alias set -1>
        used unsigned SI file modeptr.c line 7 size <integer_cst 0x200001bc780 32> unit size <integer_cst 0x200001bc1e0 4>
        align 32 context <function_decl 0x20000290460 test> result <pointer_type 0x20000286ee0 test_ptr32> initial <pointer_type 0x20000286ee0 test_ptr32> arg-type <pointer_type 0x20000286ee0 test_ptr32> arg-type-as-written <pointer_type 0x20000286ee0 test_ptr32>
        chain <parm_decl 0x200002902a0 b type <pointer_type 0x200002900e0 test_ptr64>
            used unsigned DI file modeptr.c line 7 size <integer_cst 0x200001bc990 64> unit size <integer_cst 0x200001bc9c0 8>
            align 64 context <function_decl 0x20000290460 test> result <pointer_type 0x200002900e0 test_ptr64> initial <pointer_type 0x200002900e0 test_ptr64> arg-type <pointer_type 0x200002900e0 test_ptr64> arg-type-as-written <pointer_type 0x200002900e0 test_ptr64>>>>

resulting in:

 <parm_decl 0x200002901c0 a
    type <pointer_type 0x20000286ee0 test_ptr32
        type <record_type 0x20000286a80 test VOID
            align 8 symtab 0 alias set -1
            pointer_to_this <pointer_type 0x20000286d20> chain <type_decl 0x20000286b60>>
        unsigned SI
        size <integer_cst 0x200001bc780 constant invariant 32>
        unit size <integer_cst 0x200001bc1e0 constant invariant 4>
        align 32 symtab 0 alias set -1>
    used unsigned SI file modeptr.c line 7 size <integer_cst 0x200001bc780 32> unit size <integer_cst 0x200001bc1e0 4>
    align 32 context <function_decl 0x20000290460 test> result <pointer_type 0x20000286ee0 test_ptr32> initial <pointer_type 0x20000286ee0 test_ptr32> arg-type <pointer_type 0x20000286ee0 test_ptr32> arg-type-as-written <pointer_type 0x20000286ee0 test_ptr32> chain <parm_decl 0x200002902a0 b>>


Any suggestions how to fix this?

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]