[Bug target/20625] [4.0 regression] ivopts produces code that generates "unaligned access exception"

falk at debian dot org gcc-bugzilla@gcc.gnu.org
Tue Mar 29 13:04:00 GMT 2005


------- Additional Comments From falk at debian dot org  2005-03-29 13:03 -------
I can reproduce this with gcc 4.0.0 20050329 on alphaev68-unknown-linux-gnu.
Test case:

struct BS {
    int i;
    char c[46];
};

void foo(struct BS* p)
{   
    int i; 
    for (i = 0; p->c[i]; i++) 
        ; 
}

int main()
{
#if defined(__alpha__) && defined(__linux__)
    #include <asm/sysinfo.h>
    #include <asm/unistd.h>
    unsigned int buf[2] = { SSIN_UACPROC, UAC_SIGBUS | UAC_NOPRINT };
    syscall(__NR_osf_setsysinfo, SSI_NVPAIRS, buf, 1, 0, 0, 0);
#endif

    struct BS p = { 0, "12" };
    foo(&p);
    return 0;
}

falk@juist:/tmp% gcc -mcpu=ev4 -O2 t.c && ./a.out
zsh: bus error (core dumped)  ./a.out
falk@juist:/tmp% gcc -fno-ivopts -mcpu=ev4 -O2 t.c && ./a.out 
falk@juist:/tmp% 


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |4.0.0
            Summary|gcc with -O2 produces code  |[4.0 regression] ivopts
                   |that generates "unaligned   |produces code that generates
                   |access exception"           |"unaligned access exception"


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20625



More information about the Gcc-bugs mailing list