bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] SVN 839 doesn't compile


From: Xiao-Yong Jin
Subject: Re: [Bug-apl] SVN 839 doesn't compile
Date: Mon, 16 Jan 2017 12:18:38 -0600

I'm seeing the same array subscript errors with gcc 4.4.7 here.

g++ -DHAVE_CONFIG_H -I. -I..    -Werror -Wall -I sql -I/usr/include   -rdynamic 
-mcpu=power7 -mtune=power7 -O3 -fno-math-errno -funsafe-math-optimizations 
-fno-rounding-math -fno-signaling-nans -fcx-limited-range -pipe -MT 
apl-ArrayIterator.o -MD -MP -MF .deps/apl-ArrayIterator.Tpo -c -o 
apl-ArrayIterator.o `test -f 'ArrayIterator.cc' || echo './'`ArrayIterator.cc
cc1plus: warnings being treated as errors
Shape.hh: In constructor 'ArrayIteratorBase::ArrayIteratorBase(const Shape&)':
Shape.hh:66: error: array subscript is above array bounds
make[3]: *** [apl-ArrayIterator.o] Error 1

The line 66 of Shape.hh reads
62    /// constructor: shape of another shape
63    Shape(const Shape & other)
64    : rho_rho(0),
65      volume(1)
66    { loop(r, other.rho_rho)   add_shape_item(other.rho[r]); }

The loop is a macro in Common.hh
#define loop(v, e) for (ShapeItem v = 0; v < ShapeItem(e); ++v)

The warning (treated as array) is because ShapeItem (v) is int64_t, while Rank 
(other.rho_rho) is int32_t.
src/APL_types.hh:42:typedef int32_t Rank;
src/APL_types.hh:48:typedef int64_t ShapeItem;


> On Jan 11, 2017, at 10:08 AM, Juergen Sauermann <address@hidden> wrote:
> 
> Hi,
> 
> the warnings should be fixed now, SVN 844.
> 
> The warning on raspberry pi:
> 
> Shape.hh: In member function ‘virtual Token Bif_F12_FORMAT::eval_B(Value_P)’: 
> Shape.hh:125:18: error: array subscript is below array bounds 
> [-Werror=array-bounds] 
>          if (rho[r])   { volume /= rho[r];  rho[r] = sh;  volume *= rho[r]; } 
>                   ^ 
> Shape.hh:126:30: error: array subscript is below array bounds 
> [-Werror=array-bounds] 
>          else          { rho[r] = sh;   recompute_volume();                 } 
> } 
>                               ^ 
> 
> seems to be entirely bogus. I have checked all occurrences of 
> Shape::set_shape_item(), including
> all inlined functions in Shape.hh using Shape::set_shape_item(), in the 
> functions mentioned, and I
> could not find any reason while the compiler came to that conclusion. 
> Unfortunately the compiler did
> not bother to tell at which line number this happens.
> 
> I also updated FILE_IO.apl as proposed.
> 
> /// Jürgen
> 
> 
> 
> On 01/11/2017 06:47 AM, David B. Lamkins wrote:
>> There's one remaining when compiling 843 under clang. The attached patch 
>> fixes that as well as the remaining error reported by gcc.
>> 
>> 
>> 
>> On Tue, Jan 10, 2017 at 03:54:36PM -0800, David Lamkins wrote:
>> 
>>> Worth noting: There are now no warnings or notes when compiling under gcc 
>>> 6.3.1.
>>> 
>>> On Tue, Jan 10, 2017 at 3:45 PM, David Lamkins 
>>> <address@hidden>
>>>  wrote:
>>> 
>>>> Thank you, Juergen.
>>>> 
>>>> SVN 843 compiles under gcc 6.3.1.
>>>> 
>>>> This is the sole remaining error when compiling with clang 3.8.0:
>>>> 
>>>> clang++ -DHAVE_CONFIG_H -I. -I..    -Werror -Wall -Wno-strict-aliasing
>>>> -Wno-deprecated-declarations -I/usr/include -I sql  -I/usr/include -I
>>>> sql   -g -O2 -MT apl-UserFunction_header.o -MD -MP -MF
>>>> .deps/apl-UserFunction_header.Tpo -c
>>>>  -o apl-UserFunction_header.o `test -f 'UserFunction_header.cc' ||
>>>> echo './'`UserFunction_header.cc
>>>> Tokenizer.cc:604:42: error: explicitly assigning value of variable of
>>>> type 'APL_Float' (aka 'double') to itself [-Werror,-Wself-assign]
>>>>         if (!imag_need_float)   imag_flt = imag_flt;
>>>>                                 ~~~~~~~~ ^ ~~~~~~~~
>>>> Tokenizer.cc:637:45: error: explicitly assigning value of variable of
>>>> type 'APL_Float' (aka 'double') to itself [-Werror,-Wself-assign]
>>>>         if (!imag_need_float)   degrees_flt = degrees_flt;
>>>>                                 ~~~~~~~~~~~ ^ ~~~~~~~~~~~
>>>> 2 errors generated.
>>>> 
>>>> 
>>>> On Tue, Jan 10, 2017 at 11:54 AM, Juergen Sauermann
>>>> 
>>>> <address@hidden>
>>>>  wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>> I believe that I fixed most warnings, *SVN 842*.
>>>>> 
>>>>> Since there were many warnings and from different sources, I might have
>>>>> overlooked
>>>>> some of them (or introduced new ones). Please keep reporting them.
>>>>> 
>>>>> /// Jürgen
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> --
>>>> "I think as musicians, we have more vision than we credit ourselves
>>>> for. We should dive into it without reserve, and take the sort of
>>>> risks it takes to be divisive and impactful. Things have yet to be
>>>> done."
>>>>    Aaron Fowler Clark
>>>> 
>>>> "Do not seek to follow in the footsteps of the masters. Seek what they 
>>>> sought."
>>>>    Matsuo Basho
>>>> 
>>>> "Knowledge speaks; wisdom listens."
>>>>    Jimi Hendrix
>>>> 
>>>> 
>>>> http://soundcloud.com/davidlamkins
>>>> http://reverbnation.com/lamkins
>>>> http://reverbnation.com/lcw
>>>> http://lamkins-guitar.com/
>>>> http://lamkins.net/
>>>> http://successful-lisp.com/
>>> 
>>> 
>>> -- 
>>> "I think as musicians, we have more vision than we credit ourselves
>>> for. We should dive into it without reserve, and take the sort of
>>> risks it takes to be divisive and impactful. Things have yet to be
>>> done."
>>>    Aaron Fowler Clark
>>> 
>>> "Do not seek to follow in the footsteps of the masters. Seek what they 
>>> sought."
>>>    Matsuo Basho
>>> 
>>> "Knowledge speaks; wisdom listens."
>>>    Jimi Hendrix
>>> 
>>> 
>>> http://soundcloud.com/davidlamkins
>>> http://reverbnation.com/lamkins
>>> http://reverbnation.com/lcw
>>> http://lamkins-guitar.com/
>>> http://lamkins.net/
>>> http://successful-lisp.com/
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]