Skip to content

__ILP32__ __LP64__ __LLP64__ #536

@monniaux

Description

@monniaux

Apparently, certain compilers define __ILP32__, __LP64__, __LLP64__ (and the same without trailing __) to imply certain sizes of integers and pointers.

#if defined(__LLP64__)
	if (sizeof(short) == 2
	    && sizeof(int) == 4
	    && sizeof(long int) == 4
	    && sizeof(long long int) == 8
	    && sizeof(void*) == 8) {
		(void)printf("Ok\n");
	} else {
		(void)printf("KO __LLP64__\n");
	}
#elif defined(__LP64__)
	if (sizeof(short) == 2
	    && sizeof(int) == 4
	    && sizeof(long int) == 8
	    && sizeof(long long int) == 8
	    && sizeof(void*) == 8) {
		(void)printf("Ok\n");
	} else {
		(void)printf("KO __LP64__\n");
	}
#elif defined(__ILP32__)
	if (sizeof(short) == 2
	    && sizeof(int) == 4
	    && sizeof(long int) == 4
	    && sizeof(void*) == 4) {
		(void)printf("Ok\n");
	} else {
		(void)printf("KO __ILP32__\n");
	}

Maybe CompCert should do likewise. Apparently it does on some platforms depending on which compiler is used as a preprocessor, but not on ARM32 for instance.

This is low priority in any case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions