[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#861281: rnahybrid: FTBFS on armel



Hi Lennart,

thanks for your suggestions.  I hereby will forward it upstream hoping
for comments.

Kind regards

     Andreas.

On Tue, Sep 26, 2017 at 11:10:04AM -0400, Lennart Sorensen wrote:
> On Tue, Sep 26, 2017 at 09:57:09AM +0100, Edmund Grimley Evans wrote:
> > The infinite loop is still there with gcc-7. I've created bug #876825.
> > 
> > Before you exclude armel, you could perhaps try doing something about
> > this warning, which is given not just on armel and may or may not be
> > related to the compiler going into an infinite loop:
> > 
> > energy.c:539:104: warning: iteration 6 invokes undefined behavior
> > [-Waggressive-loop-optimizations]
> 
> Is it because of this:
> energy.c:539:53: note: within this loop
>    for(i=0;i<ALPHASIZE;i++) for(j=0;j<ALPHASIZE;j++) for(k=0;k<=ALPHASIZE;k++) dr_dangle_dg_ar[i][j][k] = 0;
> 
> Perhaps that that k<= in the k loop should be < like in the i and j loops so it doesn't go beyond the end of the array.
> 
> ALPHASIZE is 6, so the k loop would try go one too far.  Every array allocated with ALPHASIZE certainly don't add one anywhere, so any look going from 0 to ALPHASIZE must use < not <= so there are two places in the file that are wrong.
> 
> I think this might help:
> 
> --- rnahybrid-2.1.2.orig/src/energy.c   2013-08-25 11:51:20.000000000 -0400
> +++ rnahybrid-2.1.2/src/energy.c        2017-09-26 11:04:34.747986466 -0400
> @@ -536,7 +536,7 @@
>  void init_dr_dangle_dg_ar()
>  {
>    int i,j,k;
> -  for(i=0;i<ALPHASIZE;i++) for(j=0;j<ALPHASIZE;j++) for(k=0;k<=ALPHASIZE;k++) dr_dangle_dg_ar[i][j][k] = 0;
> +  for(i=0;i<ALPHASIZE;i++) for(j=0;j<ALPHASIZE;j++) for(k=0;k<ALPHASIZE;k++) dr_dangle_dg_ar[i][j][k] = 0;
>  
>    dr_dangle_dg_ar[A][U][A] = -0.700;
>    dr_dangle_dg_ar[A][U][C] = -0.100;
> @@ -568,7 +568,7 @@
>  void init_dl_dangle_dg_ar()
>  {
>    int i,j,k;
> -  for(i=0;i<=ALPHASIZE;i++) for(j=0;j<ALPHASIZE;j++) for(k=0;k<ALPHASIZE;k++) dl_dangle_dg_ar[i][j][k] = 0;
> +  for(i=0;i<ALPHASIZE;i++) for(j=0;j<ALPHASIZE;j++) for(k=0;k<ALPHASIZE;k++) dl_dangle_dg_ar[i][j][k] = 0;
>  
>    dl_dangle_dg_ar[A][A][U] = -0.300;
>    dl_dangle_dg_ar[C][A][U] = -0.300;
> 
> > There are other warnings, too, but undefined behaviour is particularly scary.
> 
> The pointers being converted to integers concern me a bit.  That might
> cause big problems on 64 bit systems.
> 
> It sure looks like some seriously sloppy coding.
> 
> -- 
> Len Sorensen
> 

-- 
http://fam-tille.de


Reply to: