Bug#423407: gcc-snapshot: invalid warning in -O2
Package: gcc-snapshot
Version: 20070422-1
Severity: important
sample code:
=====================================
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
static int bar(void *p)
{
return (int)(intptr_t)p;
}
static int foo(const void *p)
{
return bar((void *)p);
}
int main(void)
{
printf("%d\n", foo(NULL));
return 0;
}
=====================================
works:
/usr/lib/gcc-snapshot/bin/gcc -o a.o a.c
does not work:
/usr/lib/gcc-snapshot/bin/gcc -O2 -o a.o a.c
a.c: In function 'main':
a.c:12: warning: passing argument 1 of 'bar' discards qualifiers from pointer target type
FWIW under other circumstances I even got an ICE, but I wasn't able to
reduce the testcase, and the code that generated it is not really ..
well open, so I can't give the full file sadly.
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.20-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages gcc-snapshot depends on:
ii binutils 2.17.20070210cvs-1 The GNU assembler, linker and bina
ii libasound2 1.0.13-2 ALSA library
ii libatk1.0-0 1.18.0-2 The ATK accessibility toolkit
ii libc6 2.5-7 GNU C Library: Shared libraries
ii libc6-dev 2.5-7 GNU C Library: Development Librari
ii libcairo2 1.4.6-1 The Cairo 2D vector graphics libra
ii libfontconfig1 2.4.2-1.2 generic font configuration library
ii libfreetype6 2.2.1-5 FreeType 2 font engine, shared lib
ii libgcc1 1:4.1.2-6 GCC support library
ii libgcj-bc 4.1.2-2 Link time only library for use wit
ii libglib2.0-0 2.12.12-1 The GLib library of C routines
ii libgmp3c2 2:4.2.1+dfsg-4 Multiprecision arithmetic library
ii libgtk2.0-0 2.10.12-1 The GTK+ graphical user interface
ii libice6 1:1.0.3-2 X11 Inter-Client Exchange library
ii libmpfr1 2.2.1.dfsg.1-2 multiple precision floating-point
ii libpango1.0-0 1.16.4-1 Layout and rendering of internatio
ii libsm6 1:1.0.2-2 X11 Session Management library
ii libstdc++6 4.1.2-6 The GNU Standard C++ Library v3
ii libx11-6 2:1.1.1-1 X11 client-side library
ii libxcursor1 1:1.1.8-2 X cursor management library
ii libxext6 1:1.0.3-2 X11 miscellaneous extension librar
ii libxfixes3 1:4.0.3-2 X11 miscellaneous 'fixes' extensio
ii libxi6 1:1.0.1-4 X11 Input extension library
ii libxinerama1 1:1.0.2-1 X11 Xinerama extension library
ii libxrandr2 2:1.2.1-1 X11 RandR extension library
ii libxrender1 1:0.9.2-1 X Rendering Extension client libra
ii libxtst6 1:1.0.1-5 X11 Testing -- Resource extension
ii zlib1g 1:1.2.3-13 compression library - runtime
gcc-snapshot recommends no packages.
-- no debconf information
Reply to: