pro64-support
[Top] [All Lists]

front-end misses symbol flag, causes bad alias analysis

To: pro64-support@xxxxxxxxxxx
Subject: front-end misses symbol flag, causes bad alias analysis
From: David Goodwin <goodwin@xxxxxxxxxxxxx>
Date: Tue, 24 Oct 2000 13:41:49 -0700 (PDT)
Reply-to: goodwin@xxxxxxxxxxxxx
Sender: owner-pro64-support@xxxxxxxxxxx
For the following program, the front-end is marking 'y' as "addr-saved" but
is not marking 'x'. We think this is causing later alias analysis to mark
'x' a non-aliasing, and allowing invalid load/store reordering (this
simplified example does not necessarily show the bad reordering...).

David


static int x;
static int y;

static int *get_x(){ return &x;}
static int *get_y(){ int *p = &y; return p;}

static int test()
{
  (*(get_x())) = 8;
  (*(get_y())) = 9;
  return x + y;
}



LOC 0 0 source files:   1       "/usr/local/home/goodwin/alias.c"
 LOC 1 3 
 LOC 1 4 static int *get_x(){ return &x;}
FUNC_ENTRY <1,20,get_x>
BODY
 BLOCK
 END_BLOCK
 BLOCK
 END_BLOCK
 BLOCK
 PRAGMA 0 120 <null-st> 0 (0x0) # PREAMBLE_END
  U8LDA 0 <1,21,x> T<28,anon_ptr.,8>
 U8RETURN_VAL
 END_BLOCK

=======================================================================
SYMTAB for get_x: level 2, st 0, label 0, preg 0, inito 0, st_attr 0
=======================================================================

Symbols:
=======================================================================
Labels:
=======================================================================
Pseudo-registers:
=======================================================================
INITOs:
=======================================================================
ST_ATTRs:
=======================================================================

 LOC 1 5 static int *get_y(){ int *p = &y; return p;}
FUNC_ENTRY <1,22,get_y>
BODY
 BLOCK
 END_BLOCK
 BLOCK
 END_BLOCK
 BLOCK
 PRAGMA 0 120 <null-st> 0 (0x0) # PREAMBLE_END
  U8LDA 0 <1,23,y> T<28,anon_ptr.,8>
 U8STID 0 <2,1,p> T<28,anon_ptr.,8>
  U8U8LDID 0 <2,1,p> T<28,anon_ptr.,8>
 U8RETURN_VAL
 END_BLOCK

=======================================================================
SYMTAB for get_y: level 2, st 1, label 0, preg 0, inito 0, st_attr 0
=======================================================================

Symbols:
[1]: p                  <2,1> Variable of type anon_ptr. (#28, I4*)
                Address: 0(p<2,1>)  Alignment: 8 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: AUTO
=======================================================================
Labels:
=======================================================================
Pseudo-registers:
=======================================================================
INITOs:
=======================================================================
ST_ATTRs:
=======================================================================

 LOC 1 6 
 LOC 1 7 static int test()
 LOC 1 8 {
FUNC_ENTRY <1,24,test>
BODY
 BLOCK
 END_BLOCK
 BLOCK
 END_BLOCK
 BLOCK
 PRAGMA 0 120 <null-st> 0 (0x0) # PREAMBLE_END
 LOC 1 9   (*(get_x())) = 8;
  I4INTCONST 8 (0x8)
   BLOCK
   U8CALL 126 <1,20,get_x> # flags 0x7e
   END_BLOCK
   U8U8LDID -1 <1,19,.preg_return_val> T<28,anon_ptr.,8>
  U8COMMA
 I4ISTORE 0 T<28,anon_ptr.,8>
 LOC 1 10   (*(get_y())) = 9;
  I4INTCONST 9 (0x9)
   BLOCK
   U8CALL 126 <1,22,get_y> # flags 0x7e
   END_BLOCK
   U8U8LDID -1 <1,19,.preg_return_val> T<28,anon_ptr.,8>
  U8COMMA
 I4ISTORE 0 T<28,anon_ptr.,8>
 LOC 1 11   return x + y;
   I4I4LDID 0 <1,21,x> T<4,.predef_I4,4>
   I4I4LDID 0 <1,23,y> T<4,.predef_I4,4>
  I4ADD
 I4RETURN_VAL
 END_BLOCK

=======================================================================
SYMTAB for test: level 2, st 0, label 0, preg 0, inito 0, st_attr 0
=======================================================================

Symbols:
=======================================================================
Labels:
=======================================================================
Pseudo-registers:
=======================================================================
INITOs:
=======================================================================
ST_ATTRs:
=======================================================================

=======================================================================
GLOBAL SYMTAB:
=======================================================================
File Info:
gp_group: 0, flags: 0x00000000
=======================================================================
Symbols:
[1]: .preg_B            <1,1> Pseudo-Register of type .predef_B (#1, B)
                Address: 0(.preg_B<1,1>)  Alignment: 1 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[2]: .preg_I4           <1,2> Pseudo-Register of type .predef_I4 (#4, I4)
                Address: 0(.preg_I4<1,2>)  Alignment: 4 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[3]: .preg_I8           <1,3> Pseudo-Register of type .predef_I8 (#5, I8)
                Address: 0(.preg_I8<1,3>)  Alignment: 8 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[4]: .preg_U4           <1,4> Pseudo-Register of type .predef_U4 (#8, U4)
                Address: 0(.preg_U4<1,4>)  Alignment: 4 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[5]: .preg_U8           <1,5> Pseudo-Register of type .predef_U8 (#9, U8)
                Address: 0(.preg_U8<1,5>)  Alignment: 8 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[6]: .preg_F4           <1,6> Pseudo-Register of type .predef_F4 (#10, F4)
                Address: 0(.preg_F4<1,6>)  Alignment: 4 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[7]: .preg_F8           <1,7> Pseudo-Register of type .predef_F8 (#11, F8)
                Address: 0(.preg_F8<1,7>)  Alignment: 8 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[8]: .preg_F10          <1,8> Pseudo-Register of type .predef_F10 (#12, F10)
                Address: 0(.preg_F10<1,8>)  Alignment: 16 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[9]: .preg_F16          <1,9> Pseudo-Register of type .predef_F16 (#13, F16)
                Address: 0(.preg_F16<1,9>)  Alignment: 16 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[10]: .preg_FQ          <1,10> Pseudo-Register of type .predef_FQ (#15, FQ)
                Address: 0(.preg_FQ<1,10>)  Alignment: 16 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[11]: .preg_C4          <1,11> Pseudo-Register of type .predef_C4 (#17, C4)
                Address: 0(.preg_C4<1,11>)  Alignment: 4 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[12]: .preg_C8          <1,12> Pseudo-Register of type .predef_C8 (#18, C8)
                Address: 0(.preg_C8<1,12>)  Alignment: 8 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[13]: .preg_CQ          <1,13> Pseudo-Register of type .predef_CQ (#19, CQ)
                Address: 0(.preg_CQ<1,13>)  Alignment: 16 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[14]: .preg_A8          <1,14> Pseudo-Register of type .predef_A8 (#22, 
KIND_VOID*)
                Address: 0(.preg_A8<1,14>)  Alignment: 8 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[15]: .preg_C10         <1,15> Pseudo-Register of type .predef_C10 (#23, C10)
                Address: 0(.preg_C10<1,15>)  Alignment: 16 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[16]: .preg_C16         <1,16> Pseudo-Register of type .predef_C16 (#24, C16)
                Address: 0(.preg_C16<1,16>)  Alignment: 16 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[17]: .preg_I16         <1,17> Pseudo-Register of type .predef_I16 (#25, I16)
                Address: 0(.preg_I16<1,17>)  Alignment: 16 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[18]: .preg_U16         <1,18> Pseudo-Register of type .predef_U16 (#26, U16)
                Address: 0(.preg_U16<1,18>)  Alignment: 16 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[19]: .preg_return_val  <1,19> Pseudo-Register
                Address: 0(.preg_return_val<1,19>)  
                Flags:  0x00000000, XLOCAL
                Sclass: REG
[20]: get_x             <1,20> Subprogram
                Returning anon_ptr. (#28, KIND_POINTER)  PU[1] C  flags:
                Address: 0(get_x<1,20>)  Alignment: 1 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: TEXT
[21]: x                 <1,21> Variable of type .predef_I4 (#4, I4)
                Address: 0(x<1,21>)  Alignment: 4 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: FSTATIC
[22]: get_y             <1,22> Subprogram
                Returning anon_ptr. (#28, KIND_POINTER)  PU[2] C  flags:
                Address: 0(get_y<1,22>)  Alignment: 1 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: TEXT
[23]: y                 <1,23> Variable of type .predef_I4 (#4, I4)
                Address: 0(y<1,23>)  Alignment: 4 bytes
                Flags:  0x01000000 addr_saved, XLOCAL
                Sclass: FSTATIC
[24]: test              <1,24> Subprogram
                Returning .predef_I4 (#4, I4)  PU[3] C  flags: very_high_whirl
                Address: 0(test<1,24>)  Alignment: 1 bytes
                Flags:  0x00000000, XLOCAL
                Sclass: TEXT
=======================================================================
PUs:
[1]: (anon) (#27) align 1, flags 0x0000000000000000,
        lexical level 2, LANG 0x02, TARGET_INFO 0
[2]: (anon) (#29) align 1, flags 0x0000000000000000,
        lexical level 2, LANG 0x02, TARGET_INFO 0
[3]: (anon) (#30) align 1, flags 0x0000000000001000,
        lexical level 2, LANG 0x02, TARGET_INFO 0
=======================================================================
Types:
[1]: .predef_B     : (f: 0x0000) size 0 B: SCALAR (B)
[2]: .predef_I1    : (f: 0x0000) size 1 I1: SCALAR (I1)
[3]: .predef_I2    : (f: 0x0000) size 2 I2: SCALAR (I2)
[4]: .predef_I4    : (f: 0x0000) size 4 I4: SCALAR (I4)
[5]: .predef_I8    : (f: 0x0000) size 8 I8: SCALAR (I8)
[6]: .predef_U1    : (f: 0x0000) size 1 U1: SCALAR (U1)
[7]: .predef_U2    : (f: 0x0000) size 2 U2: SCALAR (U2)
[8]: .predef_U4    : (f: 0x0000) size 4 U4: SCALAR (U4)
[9]: .predef_U8    : (f: 0x0000) size 8 U8: SCALAR (U8)
[10]: .predef_F4    : (f: 0x0000) size 4 F4: SCALAR (F4)
[11]: .predef_F8    : (f: 0x0000) size 8 F8: SCALAR (F8)
[12]: .predef_F10   : (f: 0x0000) size 16 F10: SCALAR (F10)
[13]: .predef_F16   : (f: 0x0000) size 16 F16: SCALAR (F16)
[14]: .predef_STR   : (f: 0x0000) size 0 STR: SCALAR (STR)
[15]: .predef_FQ    : (f: 0x0000) size 16 FQ: SCALAR (FQ)
[16]: .predef_M     : (f: 0x0000) size 0 M: SCALAR (M)
[17]: .predef_C4    : (f: 0x0000) size 8 C4: SCALAR (C4)
[18]: .predef_C8    : (f: 0x0000) size 16 C8: SCALAR (C8)
[19]: .predef_CQ    : (f: 0x0000) size 32 CQ: SCALAR (CQ)
[20]: .predef_V     : (f: 0x0000) size 0 V: VOID
[21]: .predef_BS    : (f: 0x0000) size 0 BS: SCALAR (BS)
[22]: .predef_A8    : (f: 0x0000) size 8 A8: -> .predef_V (#20) align 1
[23]: .predef_C10   : (f: 0x0000) size 32 C10: SCALAR (C10)
[24]: .predef_C16   : (f: 0x0000) size 32 C16: SCALAR (C16)
[25]: .predef_I16   : (f: 0x0000) size 32 I16: SCALAR (I16)
[26]: .predef_U16   : (f: 0x0000) size 32 U16: SCALAR (U16)
[27]: (anon)        : (f: 0x0000) size 0 : FUNCTION (f: 0x0000)
        returns anon_ptr. (#28) align 8
[28]: anon_ptr.     : (f: 0x0000) size 8 U8: -> .predef_I4 (#4) align 4
[29]: (anon)        : (f: 0x0000) size 0 : FUNCTION (f: 0x0000)
        returns anon_ptr. (#28) align 8
[30]: (anon)        : (f: 0x0000) size 0 : FUNCTION (f: 0x0000)
        returns .predef_I4 (#4) align 4
=======================================================================
Blocks:
=======================================================================
Tcons:
[1] F4:     0.000000
[2] F8:     0.000000000000000
=======================================================================
INITOs:
=======================================================================
ST_ATTRs:
=======================================================================
String table size = 508
=======================================================================


------------ INCLUDE_DIRECTORIES ------------

[1,0] ordinal(1) path(/usr/local/home/goodwin)

------------<<<<<<< FILES >>>>>>>------------

[2,0] ordinal(1) name(alias.c) path(1) size(186) modt(972419719)

------------<<<<<< DST INFO >>>>>------------

[0,0]:compile_unit: name(alias.c) producer(-O2) language(C89) 
case(case_sensitive)

  [0,96]:subprogram: file(1) line(4) column(0) name(get_x) type(void) 
specification(void) inline(DW_INL_not_inlined) virtuality(DW_VIRTUALITY_none) 
vtable_elem_location(0) pc(ST(1,20))

  [0,224]:subprogram: file(1) line(5) column(0) name(get_y) type(void) 
specification(void) inline(DW_INL_not_inlined) virtuality(DW_VIRTUALITY_none) 
vtable_elem_location(0) pc(ST(1,22))

  [3,96]:subprogram: file(1) line(8) column(0) name(test) type(void) 
specification(void) inline(DW_INL_not_inlined) virtuality(DW_VIRTUALITY_none) 
vtable_elem_location(0) pc(ST(1,24))
------------<<<< BLOCK INFO >>>------------
block 0:  file_scope, size = 256
block 1:  include_dirs, size = 40
block 2:  file_names, size = 44
block 3:  file_scope, size = 221

<Prev in Thread] Current Thread [Next in Thread>