git-subtree-dir: Security Research and Development with LLVM - Andrew Reiter git-subtree-mainline: aa7a9fc1e16c3c5be7ba312c4b4e37775e005101 git-subtree-split: 0605b5174c2bc286d3e95d6c0df620800bef96c7
36 строки
550 B
C
36 строки
550 B
C
/*
|
|
* NCA002
|
|
*
|
|
* NaiveConstantArg 002
|
|
*
|
|
* The diff between this and 001 is using a pointer
|
|
* which causes load/store to occur. They should be
|
|
* removed by mem2reg. Let's see.
|
|
*
|
|
*/
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
void
|
|
seed_random()
|
|
{
|
|
unsigned int *seedp;
|
|
|
|
seedp = (unsigned int *)malloc(sizeof(unsigned int));
|
|
if (seedp == NULL) return;
|
|
*seedp = 0xdeadbeef;
|
|
srandom(*seedp);
|
|
free(seedp);
|
|
}
|
|
|
|
int
|
|
main(int argc, char **argv)
|
|
{
|
|
long int rv;
|
|
|
|
seed_random();
|
|
rv = random();
|
|
(void)printf("random value = %ld\n", rv);
|
|
return 0;
|
|
}
|