linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sparse-llvm incorrect definition of local variables
@ 2017-03-07  0:08 Dibyendu Majumdar
  2017-03-07  6:44 ` Luc Van Oostenryck
  2017-03-13 11:16 ` Dibyendu Majumdar
  0 siblings, 2 replies; 14+ messages in thread
From: Dibyendu Majumdar @ 2017-03-07  0:08 UTC (permalink / raw)
  To: Linux-Sparse

Hi,

When I try to compile following in sparse-llvm:

int main(const char *argv[]) {
 int values[5];
 values[0] = 9;
 values[1] = 8;
 values[2] = 7;
 values[3] = 6;
 values[4] = 5;
 int *p = &values[4];
 return (*p == 5) ? 0 : 1;
}

I get:

@values = external global [5 x i32]
define i32 @main(i8**) {
L0:
  store i32 9, i32* getelementptr inbounds ([5 x i32], [5 x i32]*
@values, i32 0, i32 0)
  store i32 8, i32* bitcast (i8* getelementptr inbounds (i8, i8*
bitcast ([5 x i32]* @values to i8*), i64 4) to i32*)
  store i32 7, i32* bitcast (i8* getelementptr inbounds (i8, i8*
bitcast ([5 x i32]* @values to i8*), i64 8) to i32*)
  store i32 6, i32* bitcast (i8* getelementptr inbounds (i8, i8*
bitcast ([5 x i32]* @values to i8*), i64 12) to i32*)
  store i32 5, i32* bitcast (i8* getelementptr inbounds (i8, i8*
bitcast ([5 x i32]* @values to i8*), i64 16) to i32*)
  ret i32 0
}

Here 'values' has been defined above as external global, whereas it
should be allocated on the stack.

Regards
Dibyendu

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

end of thread, other threads:[~2017-03-17 10:48 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-07  0:08 sparse-llvm incorrect definition of local variables Dibyendu Majumdar
2017-03-07  6:44 ` Luc Van Oostenryck
2017-03-07  7:31   ` Dibyendu Majumdar
2017-03-08  6:53     ` Luc Van Oostenryck
2017-03-08 23:38       ` Dibyendu Majumdar
2017-03-09  1:50         ` Dibyendu Majumdar
2017-03-09 14:35           ` Luc Van Oostenryck
2017-03-09 14:42             ` Dibyendu Majumdar
2017-03-09 23:30             ` Dibyendu Majumdar
2017-03-09 23:37               ` Dibyendu Majumdar
2017-03-09 14:42         ` Luc Van Oostenryck
2017-03-13 11:16 ` Dibyendu Majumdar
2017-03-14 15:54   ` Dibyendu Majumdar
2017-03-17 10:48     ` Dibyendu Majumdar

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 NNTP newsgroup(s).