This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
status_warning() uses uninitialized status argument
- To: gcc-patches at gcc dot gnu dot org
- Subject: status_warning() uses uninitialized status argument
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 29 Nov 2000 06:32:58 -0200
- Organization: GCC Team, Red Hat
On Tru64 4.0, using `cc' as the bootstrap compiler, the latest few GCC
snapshots won't build. The problem is that, if ANSI_PROTOTYPES are
not available, *status is used before status is initialized. This
patch fixes the problem. Ok to install?
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* c-common.c (status_warning) [! ANSI_PROTOTYPES]: Load status
from va_list before using it.
Index: gcc/c-common.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-common.c,v
retrieving revision 1.195
diff -u -p -c -d -r1.195 c-common.c
*** gcc/c-common.c 2000/11/27 05:00:05 1.195
--- gcc/c-common.c 2000/11/29 08:30:15
*************** status_warning VPARAMS ((int *status, co
*** 2021,2044 ****
va_list ap;
diagnostic_context dc;
! if (status)
! *status = 1;
! else
! {
! VA_START (ap, msgid);
#ifndef ANSI_PROTOTYPES
! status = va_arg (ap, int *);
! msgid = va_arg (ap, const char *);
#endif
/* This duplicates the warning function behavior. */
set_diagnostic_context
(&dc, msgid, &ap, input_filename, lineno, /* warn = */ 1);
report_diagnostic (&dc);
-
- va_end (ap);
}
}
/* Variables used by the checking of $ operand number formats. */
--- 2021,2044 ----
va_list ap;
diagnostic_context dc;
! VA_START (ap, msgid);
#ifndef ANSI_PROTOTYPES
! status = va_arg (ap, int *);
! msgid = va_arg (ap, const char *);
#endif
+ if (status)
+ *status = 1;
+ else
+ {
/* This duplicates the warning function behavior. */
set_diagnostic_context
(&dc, msgid, &ap, input_filename, lineno, /* warn = */ 1);
report_diagnostic (&dc);
}
+
+ va_end (ap);
}
/* Variables used by the checking of $ operand number formats. */
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me