public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15885] New: spurious or misleading va_start warning
@ 2004-06-08 23:38 gcc-bugzilla at gcc dot gnu dot org
  2004-06-08 23:45 ` [Bug middle-end/15885] [3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-06-08 23:38 UTC (permalink / raw)
  To: gcc-bugs


When compiling the source below, gcc produces the warnings

x.cc:8: warning: second parameter of `va_start' not last named argument
x.cc:8: warning: second parameter of `va_start' not last named argument
 
which is at best misleading, as the second argument of va_start actually
is the last named argument.  gcc appears to give this warning in this
case if the argument is also passed by reference somewhere in the
function, as it is here in the call to bar().

I don't have my copy of the standard handy, so i'm not completely sure
that there isn't a restriction about taking a reference to an argument
used in va_start.  However, even if this test case is actually not valid,
the warning message should be changed to reflect the true problem.

Environment:
System: Linux karma 2.6.6 #15 Thu May 13 15:07:54 EDT 2004 i686 i686 i386 GNU/Linux
Architecture: i686

	<machine, os, target, libraries (multiple lines)>
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /home/sss/gcc/gcc/configure --prefix=/usr/local/gcc --enable-threads=posix --enable-long-long --enable-languages=c,c++,f95

How-To-Repeat:

Compile the following:

----------------------------
#include <cstdarg>

void bar(const int&);

void foo (int x, ...)
{
  va_list ap;
  va_start (ap, x);
  bar(x);
}

----------------------------
------- Additional Comments From snyder at fnal dot gov  2004-06-08 23:38 -------
Fix:
	<how to correct or work around the problem, if known (multiple lines)>

-- 
           Summary: spurious or misleading va_start warning
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: snyder at fnal dot gov
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug middle-end/15885] [3.5 Regression] spurious or misleading va_start warning
  2004-06-08 23:38 [Bug c++/15885] New: spurious or misleading va_start warning gcc-bugzilla at gcc dot gnu dot org
@ 2004-06-08 23:45 ` pinskia at gcc dot gnu dot org
  2004-06-08 23:52 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-08 23:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-08 23:45 -------
Confirmed.
Here is another example (but this time in C):
#include <stdarg.h>

void bar(int*);

void foo (int x, ...)
{
  va_list ap;
  va_start (ap, x);
  bar(&x);
}

Note this causes wrong code.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical
             Status|UNCONFIRMED                 |NEW
          Component|c++                         |middle-end
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic, wrong-code
      Known to fail|                            |3.5.0
      Known to work|                            |3.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-06-08 23:45:51
               date|                            |
            Summary|spurious or misleading      |[3.5 Regression] spurious or
                   |va_start warning            |misleading va_start warning
   Target Milestone|---                         |3.5.0


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug middle-end/15885] [3.5 Regression] spurious or misleading va_start warning
  2004-06-08 23:38 [Bug c++/15885] New: spurious or misleading va_start warning gcc-bugzilla at gcc dot gnu dot org
  2004-06-08 23:45 ` [Bug middle-end/15885] [3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-06-08 23:52 ` pinskia at gcc dot gnu dot org
  2004-06-09  0:38 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-08 23:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-08 23:52 -------
No this is valid code, the problem is that the front-end marks the decl (x) as TREE_ADDRESSABLE, so 
when the gimplify comes along it loads the decl into another tempary decl which causes this warning 
but this also causes wrong code too.

-- 


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug middle-end/15885] [3.5 Regression] spurious or misleading va_start warning
  2004-06-08 23:38 [Bug c++/15885] New: spurious or misleading va_start warning gcc-bugzilla at gcc dot gnu dot org
  2004-06-08 23:45 ` [Bug middle-end/15885] [3.5 Regression] " pinskia at gcc dot gnu dot org
  2004-06-08 23:52 ` pinskia at gcc dot gnu dot org
@ 2004-06-09  0:38 ` pinskia at gcc dot gnu dot org
  2004-06-09 16:04 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-09  0:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-09 00:38 -------
Note this also the reason why gcc.dg/altivec-varargs-1.c  fails on powerpc-apple-darwin.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
  GCC build triplet|i686-pc-linux-gnu           |
   GCC host triplet|i686-pc-linux-gnu           |
 GCC target triplet|i686-pc-linux-gnu           |


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug middle-end/15885] [3.5 Regression] spurious or misleading va_start warning
  2004-06-08 23:38 [Bug c++/15885] New: spurious or misleading va_start warning gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-06-09  0:38 ` pinskia at gcc dot gnu dot org
@ 2004-06-09 16:04 ` pinskia at gcc dot gnu dot org
  2004-06-17 22:42 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-09 16:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-09 16:04 -------
Jason do you want to look at this one, it is related to gimplifing __builtin_va_start

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug middle-end/15885] [3.5 Regression] spurious or misleading va_start warning
  2004-06-08 23:38 [Bug c++/15885] New: spurious or misleading va_start warning gcc-bugzilla at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-06-09 16:04 ` pinskia at gcc dot gnu dot org
@ 2004-06-17 22:42 ` pinskia at gcc dot gnu dot org
  2004-07-13 18:13 ` [Bug middle-end/15885] [3.5 Regression] wrong va_start warning (and code) jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-17 22:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-17 22:42 -------
*** Bug 16041 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wanderer at rsu dot ru


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug middle-end/15885] [3.5 Regression] wrong va_start warning (and code)
  2004-06-08 23:38 [Bug c++/15885] New: spurious or misleading va_start warning gcc-bugzilla at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-06-17 22:42 ` pinskia at gcc dot gnu dot org
@ 2004-07-13 18:13 ` jason at gcc dot gnu dot org
  2004-07-15 21:50 ` cvs-commit at gcc dot gnu dot org
  2004-07-15 22:08 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2004-07-13 18:13 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug middle-end/15885] [3.5 Regression] wrong va_start warning (and code)
  2004-06-08 23:38 [Bug c++/15885] New: spurious or misleading va_start warning gcc-bugzilla at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-07-13 18:13 ` [Bug middle-end/15885] [3.5 Regression] wrong va_start warning (and code) jason at gcc dot gnu dot org
@ 2004-07-15 21:50 ` cvs-commit at gcc dot gnu dot org
  2004-07-15 22:08 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-07-15 21:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-07-15 21:50 -------
Subject: Bug 15885

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jason@gcc.gnu.org	2004-07-15 21:50:51

Modified files:
	gcc            : ChangeLog gimplify.c 
	gcc/cp         : ChangeLog cp-lang.c 

Log message:
	* cp-lang.c (cxx_types_compatible_p): To the middle-end,
	references and pointers are compatible.
	
	PR middle-end/15885
	* gimplify.c (gimplify_arg): New fn, split out from...
	(gimplify_call_expr): Here.  Special-case BUILT_IN_VA_START.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.4550&r2=2.4551
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gimplify.c.diff?cvsroot=gcc&r1=2.47&r2=2.48
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4204&r2=1.4205
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-lang.c.diff?cvsroot=gcc&r1=1.85&r2=1.86



-- 


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug middle-end/15885] [3.5 Regression] wrong va_start warning (and code)
  2004-06-08 23:38 [Bug c++/15885] New: spurious or misleading va_start warning gcc-bugzilla at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-07-15 21:50 ` cvs-commit at gcc dot gnu dot org
@ 2004-07-15 22:08 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-15 22:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-15 22:08 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-07-15 22:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-08 23:38 [Bug c++/15885] New: spurious or misleading va_start warning gcc-bugzilla at gcc dot gnu dot org
2004-06-08 23:45 ` [Bug middle-end/15885] [3.5 Regression] " pinskia at gcc dot gnu dot org
2004-06-08 23:52 ` pinskia at gcc dot gnu dot org
2004-06-09  0:38 ` pinskia at gcc dot gnu dot org
2004-06-09 16:04 ` pinskia at gcc dot gnu dot org
2004-06-17 22:42 ` pinskia at gcc dot gnu dot org
2004-07-13 18:13 ` [Bug middle-end/15885] [3.5 Regression] wrong va_start warning (and code) jason at gcc dot gnu dot org
2004-07-15 21:50 ` cvs-commit at gcc dot gnu dot org
2004-07-15 22:08 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).