Package: gcc
Version: 4:4.9.1-5
Hi,
If trying to compile the attached file on armhf with
gcc -O2 -c reg.c
one gets
/tmp/ccuv9e3N.s: Assembler messages:
/tmp/ccuv9e3N.s:106: Error: registers may not be the same -- `str r2,[r2],#4'
A workaround is to use either -fno-expensive-optimizations or
-fno-schedule-insns.
gcc -O1 -fexpensive-optimizations -fschedule-insns -c reg.c
shows the same error.
The file is a shortened version from one of my packages (starlink-ast) which
always compiled nicely on armhf, started to fail with gcc-4.9.1 [1]. With
gcc-4.8.4, the compilation succeeded [2]:
gcc -DHAVE_CONFIG_H -I. -D_FORTIFY_SOURCE=2 -I/usr/include/star -DTHREAD_SAFE
-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -c region.c
-fPIC -DPIC -o .libs/libstarlink_ast_la-region.o
/tmp/ccJsRMs3.s: Assembler messages:
/tmp/ccJsRMs3.s:21403: Warning: base register written back, and overlaps one of
transfer registers
/tmp/ccJsRMs3.s:28133: Error: registers may not be the same -- `str r3,[r3],#4'
/tmp/ccJsRMs3.s:28971: Warning: base register written back, and overlaps one of
transfer registers
The warnings are on similar places as above, just with the floats replaced by
doubles or long doubles.
Best regards
Ole
[1]
https://buildd.debian.org/status/fetch.php?pkg=starlink-ast&arch=armhf&ver=8.0.2%2Bdfsg-1&stamp=1414223014
[2]
https://buildd.debian.org/status/fetch.php?pkg=starlink-ast&arch=armhf&ver=8.0.0%2Bdfsg-2&stamp=1400237749
#include
void *astFree();
void *astMalloc();
int astOK = 1;
int MaskF( int inside, int ndim,
const int lbnd[], const int ubnd[],
float in[], float val) {
void *used_region;
float *c, *d, *tmp_out;
double *lbndgd, *ubndgd;
int *lbndg, *ubndg, idim, ipix, nax, nin, nout, npix, npixg, result = 0;
if ( !astOK ) return result;
lbndg = astMalloc( sizeof( int )*(size_t) ndim );
ubndg = astMalloc( sizeof( int )*(size_t) ndim );
lbndgd = astMalloc( sizeof( double )*(size_t) ndim );
ubndgd = astMalloc( sizeof( double )*(size_t) ndim );
npix = 1;
npixg = 1;
for ( idim = 0; idim < ndim; idim++ ) {
npix *= ubnd[ idim ] - lbnd[ idim ];
npixg *= ubndg[ idim ] - lbndg[ idim ];
}
if( npixg <= 0 ){
if( astGetNegated( used_region )) {
c = in;
for( ipix = 0; ipix < npix; ipix++ ) *(c++) = val;
}
} else if( npixg > 0) {
if(astGetNegated( used_region )) {
tmp_out = astMalloc( sizeof( float )*(size_t) npix );
if( tmp_out ) {
c = tmp_out;
}
}
result += astResampleF( used_region, lbnd, ubnd,
ubnd, lbndg, ubndg);
}
return result;
}