[msp430-elf] Compile-time warnings

Orlando Arias orlandoarias@gmail.com
Tue May 31 15:27:00 GMT 2016


Greetings,

When building the latest snapshot for the msp430-elf target, I get a few
compile time warnings which I have attached to this message. I attempted
to attach the full build log, but the e-mail bounced as it was over 3MB
in size. Most of these revolve around implicit overflows and casts from
pointers to integers of different size [there are also some make-related
warnings, but I do not think these are important]. I am unsure whether
these warnings will have side-effects on the code generation I am using
gcc 6.1.0 as the compiler. In the upcoming weeks, I may have time to
help with patching some of these, if needed, although they seem rather
trivial at first glance. Thank you for your time.

Cheers,
Orlando.
-------------- next part --------------
Makefile:1550: warning: overriding recipe for target 'lib_a-mbtowc_r.o'
Makefile:841: warning: ignoring old recipe for target 'lib_a-mbtowc_r.o'

../../../../../../newlib/libc/stdlib/arc4random.c: In function '_rs_stir':
../../../../../../newlib/libc/stdlib/arc4random.c:102:17: warning: large integer implicitly truncated to unsigned type [-Woverflow]
  rs->rs_count = 1600000;
                 ^~~~~~~
../../../../../../newlib/libc/stdlib/nano-mallocr.c: In function 'sbrk_aligned':
../../../../../../newlib/libc/stdlib/nano-mallocr.c:222:31: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     align_p = (char*)ALIGN_TO((unsigned long)p, CHUNK_ALIGN);
                               ^
../../../../../../newlib/libc/stdlib/nano-mallocr.c:110:8: note: in definition of macro 'ALIGN_TO'
     (((size) + (align) -1L) & ~((align) -1L))
        ^~~~
../../../../../../newlib/libc/stdlib/nano-mallocr.c:222:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     align_p = (char*)ALIGN_TO((unsigned long)p, CHUNK_ALIGN);
               ^
../../../../../../newlib/libc/stdlib/nano-mallocr.c: In function '_malloc_r':
../../../../../../newlib/libc/stdlib/nano-mallocr.c:313:34: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     align_ptr = (char *)ALIGN_TO((unsigned long)ptr, MALLOC_ALIGN);
                                  ^
../../../../../../newlib/libc/stdlib/nano-mallocr.c:110:8: note: in definition of macro 'ALIGN_TO'
     (((size) + (align) -1L) & ~((align) -1L))
        ^~~~
../../../../../../newlib/libc/stdlib/nano-mallocr.c:313:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     align_ptr = (char *)ALIGN_TO((unsigned long)ptr, MALLOC_ALIGN);
                 ^
../../../../../../newlib/libc/stdlib/nano-mallocr.c: In function '_memalign_r':
../../../../../../newlib/libc/stdlib/nano-mallocr.c:571:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
                   (unsigned long)((char *)chunk_p + CHUNK_OFFSET),
                   ^
../../../../../../newlib/libc/stdlib/nano-mallocr.c:110:8: note: in definition of macro 'ALIGN_TO'
     (((size) + (align) -1L) & ~((align) -1L))
        ^~~~
../../../../../../newlib/libc/stdlib/nano-mallocr.c:570:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     aligned_p = (char *)ALIGN_TO(
                 ^

In file included from ../../../../../../newlib/libc/search/hash.c:58:0:
../../../../../../newlib/libc/search/hash.c: In function '__hash_open':
../../../../../../newlib/libc/search/hash.h:146:22: warning: overflow in implicit constant conversion [-Woverflow]
 #define DEF_BUFSIZE  65536  /* 64 K */
                      ^
../../../../../../newlib/libc/search/hash.c:224:21: note: in expansion of macro 'DEF_BUFSIZE'
   __buf_init(hashp, DEF_BUFSIZE);
                     ^~~~~~~~~~~
../../../../../../newlib/libc/search/hash.c: In function 'init_hash':
../../../../../../newlib/libc/search/hash.h:152:22: warning: overflow in implicit constant conversion [-Woverflow]
 #define DEF_FFACTOR  65536
                      ^
../../../../../../newlib/libc/search/hash.c:334:19: note: in expansion of macro 'DEF_FFACTOR'
  hashp->FFACTOR = DEF_FFACTOR;
                   ^~~~~~~~~~~
In file included from ../../../../../../newlib/libc/search/hash.c:57:0:
../../../../../../newlib/libc/search/hash.c: In function 'flush_meta':
../../../../../../newlib/libc/search/db_local.h:132:19: warning: overflow in implicit constant conversion [-Woverflow]
 #define HASHMAGIC 0x061561
                   ^
../../../../../../newlib/libc/search/hash.c:535:17: note: in expansion of macro 'HASHMAGIC'
  hashp->MAGIC = HASHMAGIC;
                 ^~~~~~~~~
../../../../../../newlib/libc/search/hash_buf.c: In function '__get_buf':
../../../../../../newlib/libc/search/hash_buf.c:154:8: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
        (BUFHEAD *)((ptrdiff_t)bp | is_disk_mask);
        ^

../../../../../../newlib/libm/math/e_scalb.c: In function '__ieee754_scalb':
../../../../../../newlib/libm/math/e_scalb.c:50:37: warning: overflow in implicit constant conversion [-Woverflow]
  if (-fn > 65000.0) return scalbn(x,-65000);
                                     ^
../../../../../../newlib/libm/common/s_round.c: In function 'round':
../../../../../../newlib/libm/common/s_round.c:71:26: warning: left shift count >= width of type [-Wshift-count-overflow]
             msw |= (1023 << 20);
                          ^~

Makefile:1550: warning: overriding recipe for target 'lib_a-mbtowc_r.o'
Makefile:841: warning: ignoring old recipe for target 'lib_a-mbtowc_r.o'

../../../../../../newlib/libc/stdlib/arc4random.c: In function '_rs_stir':
../../../../../../newlib/libc/stdlib/arc4random.c:102:17: warning: large integer implicitly truncated to unsigned type [-Woverflow]
  rs->rs_count = 1600000;
                 ^~~~~~~
../../../../../../newlib/libc/stdlib/nano-mallocr.c: In function 'sbrk_aligned':
../../../../../../newlib/libc/stdlib/nano-mallocr.c:222:31: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     align_p = (char*)ALIGN_TO((unsigned long)p, CHUNK_ALIGN);
                               ^
../../../../../../newlib/libc/stdlib/nano-mallocr.c:110:8: note: in definition of macro 'ALIGN_TO'
     (((size) + (align) -1L) & ~((align) -1L))
        ^~~~
../../../../../../newlib/libc/stdlib/nano-mallocr.c:222:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     align_p = (char*)ALIGN_TO((unsigned long)p, CHUNK_ALIGN);
               ^
../../../../../../newlib/libc/stdlib/nano-mallocr.c: In function '_malloc_r':
../../../../../../newlib/libc/stdlib/nano-mallocr.c:313:34: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     align_ptr = (char *)ALIGN_TO((unsigned long)ptr, MALLOC_ALIGN);
                                  ^
../../../../../../newlib/libc/stdlib/nano-mallocr.c:110:8: note: in definition of macro 'ALIGN_TO'
     (((size) + (align) -1L) & ~((align) -1L))
        ^~~~
../../../../../../newlib/libc/stdlib/nano-mallocr.c:313:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     align_ptr = (char *)ALIGN_TO((unsigned long)ptr, MALLOC_ALIGN);
                 ^
../../../../../../newlib/libc/stdlib/nano-mallocr.c: In function '_memalign_r':
../../../../../../newlib/libc/stdlib/nano-mallocr.c:571:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
                   (unsigned long)((char *)chunk_p + CHUNK_OFFSET),
                   ^
../../../../../../newlib/libc/stdlib/nano-mallocr.c:110:8: note: in definition of macro 'ALIGN_TO'
     (((size) + (align) -1L) & ~((align) -1L))
        ^~~~
../../../../../../newlib/libc/stdlib/nano-mallocr.c:570:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     aligned_p = (char *)ALIGN_TO(
                 ^

In file included from ../../../../../../newlib/libc/search/hash.c:58:0:
../../../../../../newlib/libc/search/hash.c: In function '__hash_open':
../../../../../../newlib/libc/search/hash.h:146:22: warning: overflow in implicit constant conversion [-Woverflow]
 #define DEF_BUFSIZE  65536  /* 64 K */
                      ^
../../../../../../newlib/libc/search/hash.c:224:21: note: in expansion of macro 'DEF_BUFSIZE'
   __buf_init(hashp, DEF_BUFSIZE);
                     ^~~~~~~~~~~
../../../../../../newlib/libc/search/hash.c: In function 'init_hash':
../../../../../../newlib/libc/search/hash.h:152:22: warning: overflow in implicit constant conversion [-Woverflow]
 #define DEF_FFACTOR  65536
                      ^
../../../../../../newlib/libc/search/hash.c:334:19: note: in expansion of macro 'DEF_FFACTOR'
  hashp->FFACTOR = DEF_FFACTOR;
                   ^~~~~~~~~~~
In file included from ../../../../../../newlib/libc/search/hash.c:57:0:
../../../../../../newlib/libc/search/hash.c: In function 'flush_meta':
../../../../../../newlib/libc/search/db_local.h:132:19: warning: overflow in implicit constant conversion [-Woverflow]
 #define HASHMAGIC 0x061561
                   ^
../../../../../../newlib/libc/search/hash.c:535:17: note: in expansion of macro 'HASHMAGIC'
  hashp->MAGIC = HASHMAGIC;
                 ^~~~~~~~~
../../../../../../newlib/libc/search/hash_buf.c: In function '__get_buf':
../../../../../../newlib/libc/search/hash_buf.c:154:8: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
        (BUFHEAD *)((ptrdiff_t)bp | is_disk_mask);
        ^
../../../../../../newlib/libc/search/hcreate_r.c: In function 'hcreate_r':
../../../../../../newlib/libc/search/hcreate_r.c:76:32: warning: left shift count >= width of type [-Wshift-count-overflow]
 #define MAX_BUCKETS ((size_t)1 << MAX_BUCKETS_LG2)
                                ^
../../../../../../newlib/libc/search/hcreate_r.c:98:12: note: in expansion of macro 'MAX_BUCKETS'
  if (nel > MAX_BUCKETS)
            ^~~~~~~~~~~
../../../../../../newlib/libc/search/hcreate_r.c:76:32: warning: left shift count >= width of type [-Wshift-count-overflow]
 #define MAX_BUCKETS ((size_t)1 << MAX_BUCKETS_LG2)
                                ^
../../../../../../newlib/libc/search/hcreate_r.c:99:9: note: in expansion of macro 'MAX_BUCKETS'
   nel = MAX_BUCKETS;
         ^~~~~~~~~~~

Makefile:1936: warning: overriding recipe for target 'lib_a-vfwscanf.o'
Makefile:1626: warning: ignoring old recipe for target 'lib_a-vfwscanf.o'

../../../../../../newlib/libc/stdio/tmpnam.c: In function '_tempnam_r':
../../../../../../newlib/libc/stdio/tmpnam.c:186:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       _getpid_r (p) ^ (int) (_POINTER_INT) p, &p->_inc))
                             ^
../../../../../../newlib/libc/stdio/open_memstream.c: In function 'internal_open_memstream_r':
../../../../../../newlib/libc/stdio/open_memstream.c:334:24: warning: integer overflow in expression [-Woverflow]
   else if (c->max > 64 * 1024)
                        ^
../../../../../../newlib/libc/stdio/open_memstream.c:335:17: warning: integer overflow in expression [-Woverflow]
     c->max = 64 * 1024;
                 ^

../../../../../../newlib/libc/misc/__dprintf.c: In function '__dprintf':
../../../../../../newlib/libc/misc/__dprintf.c:134:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
        l = (_POINTER_INT) va_arg (args, char *);
            ^

../../../../../../newlib/libm/math/e_scalb.c: In function '__ieee754_scalb':
../../../../../../newlib/libm/math/e_scalb.c:50:37: warning: overflow in implicit constant conversion [-Woverflow]
  if (-fn > 65000.0) return scalbn(x,-65000);
                                     ^

../../../../../../newlib/libm/common/s_round.c: In function 'round':
../../../../../../newlib/libm/common/s_round.c:71:26: warning: left shift count >= width of type [-Wshift-count-overflow]
             msw |= (1023 << 20);
                          ^~

Makefile:1550: warning: overriding recipe for target 'lib_a-mbtowc_r.o'
Makefile:841: warning: ignoring old recipe for target 'lib_a-mbtowc_r.o'

../../../../../newlib/libc/stdlib/arc4random.c: In function '_rs_stir':
../../../../../newlib/libc/stdlib/arc4random.c:102:17: warning: large integer implicitly truncated to unsigned type [-Woverflow]
  rs->rs_count = 1600000;
                 ^~~~~~~
../../../../../newlib/libc/stdlib/nano-mallocr.c: In function 'sbrk_aligned':
../../../../../newlib/libc/stdlib/nano-mallocr.c:222:31: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     align_p = (char*)ALIGN_TO((unsigned long)p, CHUNK_ALIGN);
                               ^
../../../../../newlib/libc/stdlib/nano-mallocr.c:110:8: note: in definition of macro 'ALIGN_TO'
     (((size) + (align) -1L) & ~((align) -1L))
        ^~~~
../../../../../newlib/libc/stdlib/nano-mallocr.c:222:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     align_p = (char*)ALIGN_TO((unsigned long)p, CHUNK_ALIGN);
               ^
../../../../../newlib/libc/stdlib/nano-mallocr.c: In function '_malloc_r':
../../../../../newlib/libc/stdlib/nano-mallocr.c:313:34: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     align_ptr = (char *)ALIGN_TO((unsigned long)ptr, MALLOC_ALIGN);
                                  ^
../../../../../newlib/libc/stdlib/nano-mallocr.c:110:8: note: in definition of macro 'ALIGN_TO'
     (((size) + (align) -1L) & ~((align) -1L))
        ^~~~
../../../../../newlib/libc/stdlib/nano-mallocr.c:313:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     align_ptr = (char *)ALIGN_TO((unsigned long)ptr, MALLOC_ALIGN);
                 ^
../../../../../newlib/libc/stdlib/nano-mallocr.c: In function '_memalign_r':
../../../../../newlib/libc/stdlib/nano-mallocr.c:571:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
                   (unsigned long)((char *)chunk_p + CHUNK_OFFSET),
                   ^
../../../../../newlib/libc/stdlib/nano-mallocr.c:110:8: note: in definition of macro 'ALIGN_TO'
     (((size) + (align) -1L) & ~((align) -1L))
        ^~~~
../../../../../newlib/libc/stdlib/nano-mallocr.c:570:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     aligned_p = (char *)ALIGN_TO(
                 ^

In file included from ../../../../../newlib/libc/search/hash.c:58:0:
../../../../../newlib/libc/search/hash.c: In function '__hash_open':
../../../../../newlib/libc/search/hash.h:146:22: warning: overflow in implicit constant conversion [-Woverflow]
 #define DEF_BUFSIZE  65536  /* 64 K */
                      ^
../../../../../newlib/libc/search/hash.c:224:21: note: in expansion of macro 'DEF_BUFSIZE'
   __buf_init(hashp, DEF_BUFSIZE);
                     ^~~~~~~~~~~
../../../../../newlib/libc/search/hash.c: In function 'init_hash':
../../../../../newlib/libc/search/hash.h:152:22: warning: overflow in implicit constant conversion [-Woverflow]
 #define DEF_FFACTOR  65536
                      ^
../../../../../newlib/libc/search/hash.c:334:19: note: in expansion of macro 'DEF_FFACTOR'
  hashp->FFACTOR = DEF_FFACTOR;
                   ^~~~~~~~~~~
In file included from ../../../../../newlib/libc/search/hash.c:57:0:
../../../../../newlib/libc/search/hash.c: In function 'flush_meta':
../../../../../newlib/libc/search/db_local.h:132:19: warning: overflow in implicit constant conversion [-Woverflow]
 #define HASHMAGIC 0x061561
                   ^
../../../../../newlib/libc/search/hash.c:535:17: note: in expansion of macro 'HASHMAGIC'
  hashp->MAGIC = HASHMAGIC;
                 ^~~~~~~~~
../../../../../newlib/libc/search/hash_buf.c: In function '__get_buf':
../../../../../newlib/libc/search/hash_buf.c:154:8: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
        (BUFHEAD *)((ptrdiff_t)bp | is_disk_mask);
        ^

../../../../../newlib/libm/math/e_scalb.c: In function '__ieee754_scalb':
../../../../../newlib/libm/math/e_scalb.c:50:37: warning: overflow in implicit constant conversion [-Woverflow]
  if (-fn > 65000.0) return scalbn(x,-65000);
                                     ^

../../../../../newlib/libm/common/s_round.c: In function 'round':
../../../../../newlib/libm/common/s_round.c:71:26: warning: left shift count >= width of type [-Wshift-count-overflow]
             msw |= (1023 << 20);
                          ^~
Makefile:139: warning: overriding recipe for target '.S.o'
Makefile:115: warning: ignoring old recipe for target '.S.o'

../../../../libgloss/msp430/sbrk.c: In function '_sbrk':
../../../../libgloss/msp430/sbrk.c:25:7: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
       write (1, MESSAGE, sizeof MESSAGE);
       ^~~~~
../../../../libgloss/msp430/sbrk.c:26:7: warning: implicit declaration of function 'abort' [-Wimplicit-function-declaration]
       abort ();
       ^~~~~
../../../../libgloss/msp430/sbrk.c:26:7: warning: incompatible implicit declaration of built-in function 'abort'
../../../../libgloss/msp430/sbrk.c:26:7: note: include '<stdlib.h>' or provide a declaration of 'abort'

Makefile:139: warning: overriding recipe for target '.S.o'
Makefile:115: warning: ignoring old recipe for target '.S.o'

../../../../../libgloss/msp430/sbrk.c: In function '_sbrk':
../../../../../libgloss/msp430/sbrk.c:25:7: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
       write (1, MESSAGE, sizeof MESSAGE);
       ^~~~~
../../../../../libgloss/msp430/sbrk.c:26:7: warning: implicit declaration of function 'abort' [-Wimplicit-function-declaration]
       abort ();
       ^~~~~
../../../../../libgloss/msp430/sbrk.c:26:7: warning: incompatible implicit declaration of built-in function 'abort'
../../../../../libgloss/msp430/sbrk.c:26:7: note: include '<stdlib.h>' or provide a declaration of 'abort'

Makefile:139: warning: overriding recipe for target '.S.o'
Makefile:115: warning: ignoring old recipe for target '.S.o'

../../../../../libgloss/msp430/sbrk.c: In function '_sbrk':
../../../../../libgloss/msp430/sbrk.c:25:7: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
       write (1, MESSAGE, sizeof MESSAGE);
       ^~~~~
../../../../../libgloss/msp430/sbrk.c:26:7: warning: implicit declaration of function 'abort' [-Wimplicit-function-declaration]
       abort ();
       ^~~~~
../../../../../libgloss/msp430/sbrk.c:26:7: warning: incompatible implicit declaration of built-in function 'abort'
../../../../../libgloss/msp430/sbrk.c:26:7: note: include '<stdlib.h>' or provide a declaration of 'abort'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/newlib/attachments/20160531/7dbc130e/attachment.sig>


More information about the Newlib mailing list