Skip to contentSkip to conversation

sparse-llvm: pseudo_to_value: Assertion `sym->ident == ((void *)0)' failed

DISCUSSION Benjamin Herrenschmidt 2 participants 2 messages Feb 13, 2012 Sparse checker

lore
Share & tools
lore
#0 lore raw

Hi folks !

Haven't had a chance to investigate further today (and probably won't) so I'm shooting this here just in case ;-)

I was tracking down what looks like an LLVM bug with sign extension from 1-bit integers while playing with llvmpipe (gallium llvm backend) and out of curiosity decided to look at what sparse generated when sign-extending a bool :-)

So I added to my earlier hello.c some statements to that effect, and trying to compile it results in:

sparse-llvm.c:311: pseudo_to_value: Assertion `sym->ident == ((void *)0)' failed.

The new hello.c is:

#include <stdio.h>
#include <stdbool.h>

int main(void)

{
        int i;
        double f1,f2;
        bool eq;

        printf("Hello World !\n");

        for (i = 0; i < 10; i ++)
                printf("I can count to %d\n", i);

        printf("f1=");
        scanf("%f",&f1);
        printf("f2=");
        scanf("%f",&f2);

        eq = f1 == f2;

        printf("f1==f2: %d\n", (int)eq);
        return 0;
}

Cheers,
Ben.

#1 lore raw
Quoted 36 lines · Benjamin Herrenschmidt

Hi folks !

Haven't had a chance to investigate further today (and probably won't) so I'm shooting this here just in case ;-)

I was tracking down what looks like an LLVM bug with sign extension from 1-bit integers while playing with llvmpipe (gallium llvm backend) and out of curiosity decided to look at what sparse generated when sign-extending a bool :-)

So I added to my earlier hello.c some statements to that effect, and trying to compile it results in:

sparse-llvm.c:311: pseudo_to_value: Assertion `sym->ident == ((void *)0)' failed.

The new hello.c is:

#include <stdio.h>
#include <stdbool.h>

int main(void)
{
       int i;
       double f1,f2;
       bool eq;

       printf("Hello World !\n");

       for (i = 0; i < 10; i ++)
               printf("I can count to %d\n", i);

       printf("f1=");
       scanf("%f",&f1);
       printf("f2=");
       scanf("%f",&f2);

Quoted 5 lines

       eq = f1 == f2;

       printf("f1==f2: %d\n", (int)eq);
       return 0;
}

I can reproduce the issue with this minimal test case:

#include <stdio.h>

int main(int argc, char *argv[])

{
	float f;

	scanf("%f", &f);

	return 0;
}

It looks like we need to teach pseudo_to_value() about ident symbols.

Pekka
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html