public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: markku.pihlajamaa@luukku.com To: gcc-gnats@gcc.gnu.org Subject: target/6431: v850-elf-gcc, va_arg() fails in expanding arguments Date: Tue, 23 Apr 2002 11:16:00 -0000 [thread overview] Message-ID: <20020423181349.19007.qmail@sources.redhat.com> (raw) >Number: 6431 >Category: target >Synopsis: v850-elf-gcc, va_arg() fails in expanding arguments >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Tue Apr 23 11:16:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Markku Pihlajamaa >Release: gcc version 2.96-xscale-010827 >Organization: >Environment: GNU C cross compiler, configured for the v850-elf target, the compiler is run on a PC and the operating system is Red Hat Linux 7.1. >Description: The first optional argument is not expanded by va_arg() at all, but is skipped, and the last optional argument is expanded to a random number. >How-To-Repeat: #include <stdarg.h> extern int out ( int ); void test( int parc, ... ) { va_list list; va_start( list, parc ); while( parc ) { int i; i = va_arg( list, int ); out( i ); parc --; } va_end( list ); } int main( void ) { test( 4, 1, 2, 3, 4 ); return 0; } >Fix: *** gcc/config/v850/v850.c.original Sat Jan 8 10:15:57 2000 --- gcc/config/v850/v850.c Tue Apr 23 13:55:30 2002 *************** *** 3653,3659 **** incr = build (MODIFY_EXPR, ptr_type_node, valist, incr); TREE_SIDE_EFFECTS (incr) = 1; - expand_expr (incr, const0_rtx, VOIDmode, EXPAND_NORMAL); addr_rtx = expand_expr (addr, NULL, Pmode, EXPAND_NORMAL); if (indirect) --- 3653,3660 ---- incr = build (MODIFY_EXPR, ptr_type_node, valist, incr); TREE_SIDE_EFFECTS (incr) = 1; addr_rtx = expand_expr (addr, NULL, Pmode, EXPAND_NORMAL); + + expand_expr (incr, const0_rtx, VOIDmode, EXPAND_NORMAL); if (indirect) >Release-Note: >Audit-Trail: >Unformatted:
reply other threads:[~2002-04-23 18:16 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20020423181349.19007.qmail@sources.redhat.com \ --to=markku.pihlajamaa@luukku.com \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).