> On May 5, 2015, at 8:13 PM, Aditya K <hiradi...@msn.com> wrote:
> 
> So, I analyzed other warnings and following is the list of relevant warning 
> that I could collect. Hope this is useful.
> 
> 
> gcc/ipa-icf.c:508:12: warning: logical not is only applied to the left hand 
> side of this comparison
> ../../gcc/ipa-icf.c:508:12: warning: logical not is only applied to the left 
> hand side of this comparison [-Wlogical-not-parentheses]
>       if ((!type == FUNC || address || !opt_for_fn (decl, optimize_size))
> 
> gcc/expr.c:5271:9: warning: comparison of constant -1 with expression of type 
> 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
> ../../gcc/expr.c:5271:9: warning: comparison of constant -1 with expression 
> of type 'unsigned int' is always false 
> [-Wtautological-constant-out-of-range-compare]
>           if (!SUBREG_CHECK_PROMOTED_SIGN (target,
>                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> There was a similar bug posted some time ago 
> (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61271)
> --------------------------------------------------------------------------------------------------------------------------------
> 
> gcc/reload1.c:470:28: warning: incrementing expression of type bool is 
> deprecated [-Wdeprecated-increment-bool]
> ../../gcc/reload1.c:470:28: warning: incrementing expression of type bool is 
> deprecated [-Wdeprecated-increment-bool]
>       spill_indirect_levels++;
>       ~~~~~~~~~~~~~~~~~~~~~^
> 
> Seems like for this bug we need to change the declaration of 
> 
> bool this_target_reload::x_spill_indirect_levels to an int. Even the comment 
> there mentions that this variable might take
> other integral values.
> 
>   /* Nonzero if indirect addressing is supported on the machine; this means
>      that spilling (REG n) does not require reloading it into a register in
>      order to do (MEM (REG n)) or (MEM (PLUS (REG n) (CONST_INT c))).  The
>      value indicates the level of indirect addressing supported, e.g., two
>      means that (MEM (MEM (REG n))) is also valid if (REG n) does not get
>      a hard register.  */
>   bool x_spill_indirect_levels;
> 
> 
> --------------------------------------------------------------------------------------------------------------------------------
> 
> gcc/rtlanal.c:5573:23: warning: array index 1 is past the end of the array 
> (which contains 1 element) [-Warray-bounds]
> ../../gcc/rtlanal.c:5573:23: warning: array index 1 is past the end of the 
> array (which contains 1 element) [-Warray-bounds]
>           *second = GEN_INT (CONST_DOUBLE_HIGH (value));
>                              ^~~~~~~~~~~~~~~~~~~~~~~~~

These warnings are bogus due to the array being the last element of the 
structure. 

Please file that with clang. 

Thanks,
Andrew



> 
> ../../gcc/rtl.h:1757:30: note: expanded from macro 'CONST_DOUBLE_HIGH'
> #define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode)
>                              ^           ~
> ../../gcc/rtl.h:1123:36: note: expanded from macro 'XCMWINT'
> #define XCMWINT(RTX, N, C, M)       ((RTX)->u.hwint[N])
>                                      ^
> ../../gcc/rtl.h:3193:51: note: expanded from macro 'GEN_INT'
> #define GEN_INT(N)  gen_rtx_CONST_INT (VOIDmode, (N))
>                                                   ^
> ../../gcc/rtl.h:397:5: note: array 'hwint' declared here
>     HOST_WIDE_INT hwint[1];
>     ^
> ../../gcc/hwint.h:54:26: note: expanded from macro 'HOST_WIDE_INT'
> #   define HOST_WIDE_INT long
>                          ^
> 
> --------------------------------------------------------------------------------------------------------------------------------
> 
> gcc/vec.h:1048:10: warning: offset of on non-POD type 'vec_embedded' (aka 
> 'vec<c_expr::id_tab, va_heap, vl_embed>') [-Winvalid-offsetof]
> ../../gcc/vec.h:1048:10: warning: offset of on non-POD type 'vec_embedded' 
> (aka 'vec<std::pair<expr_hash_elt *, expr_hash_elt *>, va_heap, vl_embed>') 
> [-Winvalid-offsetof]
>   return offsetof (vec_embedded, m_vecdata) + alloc * sizeof (T);
>          ^                       ~~~~~~~~~
> /home/hiraditya/work/llvm/install-release/bin/../lib/clang/3.7.0/include/stddef.h:120:24:
>  note: expanded from macro 'offsetof'
> #define offsetof(t, d) __builtin_offsetof(t, d)
> 
> 
> --------------------------------------------------------------------------------------------------------------------------------
> 
> genrtl.h:435:3: warning: array index 1 is past the end of the array (which 
> contains 1 element) [-Warray-bounds]
> ./genrtl.h:435:3: warning: array index 1 is past the end of the array (which 
> contains 1 element) [-Warray-bounds]
>   XWINT (rt, 1) = arg1;
>   ^          ~
> ../../gcc/rtl.h:1120:29: note: expanded from macro 'XWINT'
> #define XWINT(RTX, N)               ((RTX)->u.hwint[N])
>                                      ^
> ../../gcc/rtl.h:397:5: note: array 'hwint' declared here
>     HOST_WIDE_INT hwint[1];
>     ^
> ../../gcc/hwint.h:54:26: note: expanded from macro 'HOST_WIDE_INT'
> #   define HOST_WIDE_INT long
> 
> --------------------------------------------------------------------------------------------------------------------------------
> 
> gcc/final.c:3957:8: warning: array index 1 is past the end of the array 
> (which contains 1 element) [-Warray-bounds]
> ../../gcc/final.c:3957:8: warning: array index 1 is past the end of the array 
> (which contains 1 element) [-Warray-bounds]
>           if (CONST_DOUBLE_HIGH (x))
>               ^~~~~~~~~~~~~~~~~~~~~
> ../../gcc/rtl.h:1757:30: note: expanded from macro 'CONST_DOUBLE_HIGH'
> #define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode)
>                              ^           ~
> ../../gcc/rtl.h:1123:36: note: expanded from macro 'XCMWINT'
> #define XCMWINT(RTX, N, C, M)       ((RTX)->u.hwint[N])
>                                      ^
> ../../gcc/rtl.h:397:5: note: array 'hwint' declared here
>     HOST_WIDE_INT hwint[1];
>     ^
> ../../gcc/hwint.h:54:26: note: expanded from macro 'HOST_WIDE_INT'
> #   define HOST_WIDE_INT long
>                          ^
> 
> --------------------------------------------------------------------------------------------------------------------------------
> 
> gcc/cse.c:6171:38: warning: array index 1 is past the end of the array (which 
> contains 1 element) [-Warray-bounds]
> ../../gcc/cse.c:6171:38: warning: array index 1 is past the end of the array 
> (which contains 1 element) [-Warray-bounds]
>             || (CONST_DOUBLE_P (new_rtx) && CONST_DOUBLE_HIGH (new_rtx)>= 0))
>                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../../gcc/rtl.h:1757:30: note: expanded from macro 'CONST_DOUBLE_HIGH'
> #define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode)
>                              ^           ~
> ../../gcc/rtl.h:1123:36: note: expanded from macro 'XCMWINT'
> #define XCMWINT(RTX, N, C, M)       ((RTX)->u.hwint[N])
>                                      ^
> ../../gcc/rtl.h:397:5: note: array 'hwint' declared here
>     HOST_WIDE_INT hwint[1];
>     ^
> ../../gcc/hwint.h:54:26: note: expanded from macro 'HOST_WIDE_INT'
> #   define HOST_WIDE_INT long
>                          ^
> 
> --------------------------------------------------------------------------------------------------------------------------------
> 
> gcc/gcov-tool.c:225:7: warning: variable 'ret' is used uninitialized whenever 
> 'if' condition is false [-Wsometimes-uninitialized]
> gcc/gcov-tool.c:493:7: warning: variable 'ret' is used uninitialized whenever 
> 'if' condition is false [-Wsometimes-uninitialized]
> ../../gcc/gcov-tool.c:225:7: warning: variable 'ret' is used uninitialized 
> whenever 'if' condition is false [-Wsometimes-uninitialized]
>   if (argc - optind == 2)
>       ^~~~~~~~~~~~~~~~~~
> ../../gcc/gcov-tool.c:230:10: note: uninitialized use occurs here
>   return ret;
>          ^~~
> ../../gcc/gcov-tool.c:225:3: note: remove the 'if' if its condition is always 
> true
>   if (argc - optind == 2)
>   ^~~~~~~~~~~~~~~~~~~~~~~
> ../../gcc/gcov-tool.c:196:10: note: initialize the variable 'ret' to silence 
> this warning
>   int ret;
>          ^
>           = 0
> ../../gcc/gcov-tool.c:493:7: warning: variable 'ret' is used uninitialized 
> whenever 'if' condition is false [-Wsometimes-uninitialized]
>   if (argc - optind == 2)
>       ^~~~~~~~~~~~~~~~~~
> ../../gcc/gcov-tool.c:498:10: note: uninitialized use occurs here
>   return ret;
>          ^~~
> ../../gcc/gcov-tool.c:493:3: note: remove the 'if' if its condition is always 
> true
>   if (argc - optind == 2)
>   ^~~~~~~~~~~~~~~~~~~~~~~
> ../../gcc/gcov-tool.c:462:10: note: initialize the variable 'ret' to silence 
> this warning
>   int ret;
>          ^
>           = 0
> 
> 
> I think I can fix few of these if we want them to be fixed.
> For some e.g. ( gcc/gcov-tool.c:225:7: warning: array index 1 is past the end 
> of the array (which contains 1 element) ),
> I have no idea what is the proper fix for them.
> 
> -Aditya
> 
> 
>> Date: Tue, 5 May 2015 21:57:08 +0100
>> Subject: Re: Compiler warnings while compiling gcc with clang‏
>> From: jwakely....@gmail.com
>> To: hiradi...@msn.com
>> CC: pins...@gmail.com; renato.go...@linaro.org; gcc@gcc.gnu.org
>> 
>>> On 5 May 2015 at 12:39, Aditya K wrote:
>>> There are however, other differences between class and struct 
>>> (http://stackoverflow.com/a/999810/811335) i.e.,
>>> 
>>> 1. In absence of an access-specifier for a base class, public is assumed 
>>> when the derived class is declared struct and private is assumed when the 
>>> class is declared class.
>> 
>> Yes, everyone here knows that. That is only relevant to the definition
>> of the class, which can only occur once. For the purposes of
>> declarations that are not definitions there is no difference.
>> 
>>> 2. class can be used in place of a typename to declare a template 
>>> parameter, while the struct cannot.
>> 
>> Completely irrelevant in this context. The use of 'class' in a
>> template parameter list has nothing to do with struct or class types,
>> nor forward declarations of struct or class types.
>                         

Reply via email to