From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30072 invoked by alias); 18 Jun 2010 19:48:23 -0000 Received: (qmail 30030 invoked by uid 48); 18 Jun 2010 19:48:12 -0000 Date: Fri, 18 Jun 2010 19:48:00 -0000 Subject: [Bug c/44586] New: gcc does not warn about casting non-variadic types to variadic types X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "raj dot khem at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-06/txt/msg01867.txt.bz2 the folowing testcase does a casting which results in undefined behaviour but gcc does not warn about it. ypedef int (*bar_t)(int x, int y, ...); int foo(int x, int y) { return x+y; } void f(int x, int y) { bar_t bar; /* Cast foo to variadic type... undefined behaviour */ bar = (bar_t) foo; (*bar)(x,y); } -- Summary: gcc does not warn about casting non-variadic types to variadic types Product: gcc Version: 4.4.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: raj dot khem at gmail dot com GCC build triplet: x86_64-linux-gnu GCC host triplet: x86_64-linux-gnu GCC target triplet: x86_64-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44586