This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

optimization/3384: PowerPC -funroll-loops -fbranch-count-reg misoptimization



>Number:         3384
>Category:       optimization
>Synopsis:       PowerPC -funroll-loops -fbranch-count-reg misoptimization
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 22 16:36:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Zoltan Hidvegi
>Release:        3.0
>Organization:
>Environment:
System: AIX vlad 3 4 0005BA2F4C00


	
host: powerpc-ibm-aix4.3.3.0
build: powerpc-ibm-aix4.3.3.0
target: powerpc-ibm-aix4.3.3.0
configured with: ../gcc-3.0/configure --enable-languages=c,c++,java --enable-version-specific-runtime-libs --disable-nls
>Description:
gcc-3.0 miscompiles code with -O2 -funroll-loops
Workaround: use -fno-branch-count-reg or do not use -funroll-loops
This is a regression to 2.95.3 but only if you use -funroll-loops.

The testcase:

------------ BEGIN ---------------
typedef unsigned long ulong;

void
set_offsets(ulong *t, ulong idx, ulong n, ulong v)
{
    ulong i;
    for (i = idx; i < n; i += 2) {
	t[i] = v;
    }
}

int
main(void)
{
    ulong a[8];
    set_offsets(a, 0, 7, 0xdeafcabe);
    return 1;
}
------------- END ----------------
>How-To-Repeat:
% gcc -O2 -funroll-loops -o bug bug.c 
% ./bug
zsh: 16798 segmentation fault  ./bug

>Fix:
Use -fno-branch-count-reg or do not use -funroll-loops
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]