[Bug c/85962] spurious warning on right shift constant > integer in trivially dead code

2018-05-28 Thread joshudson at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85962

--- Comment #1 from Joshua  ---
(first three lines is because you don't want bug reports with external header
files--3 lines is a lot better than all of stdint.h and limits.h)

[Bug c/85962] New: spurious warning on right shift constant > integer in trivially dead code

2018-05-28 Thread joshudson at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85962

Bug ID: 85962
   Summary: spurious warning on right shift constant > integer in
trivially dead code
   Product: gcc
   Version: 6.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: joshudson at gmail dot com
  Target Milestone: ---

spurious warning on right shift constant > integer when code would be
eliminated by optimization step because it is only reachable when the warning
would not occur

Complete code snippet:

typedef unsigned long size_t;
typedef unsigned int uint32_t;
#define SIZE_MAX 0x

size_t vfunc(uint32_t n)
{
if (n > SIZE_MAX)
return n >> (sizeof(size_t) * 8);
else
return (size_t)n;
}


This senseless function is reduced from a real function in code that can't
assume the size of size_t is large enough to hold uint32_t. Note that n >
SIZE_MAX is not going to happen when compiling for 64 bits and will be
optimized away, but it raises a warning anyway:

eportbug.c: In function ‘vfunc’:
reportbug.c:8:12: warning: right shift count >= width of type
[-Wshift-count-overflow]
   return n >> (sizeof(size_t) * 8);

If the code were not optimized away, the shift would not be out of range. I
compile with -O3 to get dead code elimination.

gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-18+deb9u1'
--with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/
--enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--with-target-system-zlib --enable-objc-gc=auto --enable-multiarch
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)

[Bug target/27234] no way to stop gcc from mucking with the incoming argument stack

2006-04-22 Thread joshudson at gmail dot com


--- Comment #8 from joshudson at gmail dot com  2006-04-22 23:28 ---
The code that calls all the asmlinkage calls does so through a vector table.
Consequently, it does not know how many arguments it calls. However, the
arguments live in particular registers when called, so it just pushes all of
them
(it has to preserve all the registers anyway).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27234



[Bug c/24727] New: type const void * produces a warning when promoting to void *

2005-11-07 Thread joshudson at gmail dot com
Tried this on two machines:

SunOS hornet 5.10 Generic sun4u sparc SUNW,Ultra-4
with GCC 4.0.1
Linux numenor 2.6.13 #9 Mon Sep 19 19:03:35 PDT 2005 i686 unknown unknown
GNU/Linux
with GCC 3.3.6

The following code produces spurios warning:
/* Cut here */
int x_read(int h, void *buf, unsigned len);
int x_write(int h, const void *buf, unsigned len);

typedef int (*x_io)(int h, void *buf, unsigned len);
int blockio(int h, long long offset, void *buf, x_io action);

int bug(int h, unsigned where, void *buf)
{
return blockio(h, (long long)where  10, buf, x_write);
}
/* Cut here */
sample.c: In function `bug':
sample.c:9: warning: passing arg 4 of `blockio' from incompatible pointer type


-- 
   Summary: type const void * produces a warning when promoting to
void *
   Product: gcc
   Version: 4.0.1
Status: UNCONFIRMED
  Severity: trivial
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: joshudson at gmail dot com
  GCC host triplet: Multiple


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24727



[Bug c/24727] type const void * produces a warning when promoting to void *

2005-11-07 Thread joshudson at gmail dot com


--- Comment #2 from joshudson at gmail dot com  2005-11-08 04:25 ---
Aren't function arguments contravariant rather than covariant?


-- 

joshudson at gmail dot com changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|INVALID |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24727