Skip to content

Code gen for x86_64 broken, example included #2905

@llvmbot

Description

@llvmbot
Bugzilla Link 2533
Resolution FIXED
Resolved on Mar 06, 2010 13:59
Version unspecified
OS Linux
Reporter LLVM Bugzilla Contributor
CC @asl

Extended Description

#include <stdio.h>
#include <inttypes.h>

void dummy(const char* a) {}

typedef struct {
const char *name;
int flags;
union {
void (*func_arg)(const char *); //FIXME passing error code as int return would be nicer then exit() in the func
} u;
} OptionDef;

const OptionDef options[] = {
/* main options */
{ "a", 0, {dummy} },
{ "b", 0, {dummy} },
{ 0, },
};

int main(int argc, char *argv)
{
const OptionDef
po;
for (po=options; po->name!=0; po++) {
printf("%s\n", po->name);
}
return 0;
}

This code should iterate over all elements in 'options'. The code generated with llvm-gcc (2.3 stable) however, does not do this. When compiled with gcc, everything works as expected. On x86_32, llvm-gcc generates correct code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ABIApplication Binary InterfacebugzillaIssues migrated from bugzillamiscompilation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions