[LLVMbugs] [Bug 2533] New: Code gen for x86_64 broken, example included

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Jul 8 14:20:39 PDT 2008


           Summary: Code gen for x86_64 broken, example included
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: ABI, miscompilation
          Severity: major
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: thomas.knauth at gmx.de
                CC: llvmbugs at cs.uiuc.edu

#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.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list