Bug 36057 - [4.4 Regression] struct-layout-1_generate.c uses non-ISO C '%n$' operand number formats
Summary: [4.4 Regression] struct-layout-1_generate.c uses non-ISO C '%n$' operand n...
Alias: None
Product: gcc
Classification: Unclassified
Component: testsuite (show other bugs)
Version: 4.4.0
: P2 normal
Target Milestone: 4.4.0
Assignee: Uroš Bizjak
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Depends on:
Reported: 2008-04-26 21:18 UTC by Danny Smith
Modified: 2008-05-20 19:06 UTC (History)
3 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2008-05-17 13:10:01


Note You need to log in before you can comment on or make changes to this bug.
Description Danny Smith 2008-04-26 21:18:38 UTC
This commit 
2008-02-20  Uros Bizjak  <ubizjak@gmail.com>

	* g++.dg/compat/struct-layout-1_generate.c (DG_OPTIONS): New define.
	(switchfiles): Use DG_OPTIONS. Explicitly name arguments in fprintf
	templates to reduce number of passed arguments.

breaks the G++  struct-layout tests on MS Windows since the host printf family does not support the '%n$' extension.  The dg-options in generated files 
look like 
 /* { dg-options "-w $s -I$s" } */

After reverting that patch all 150 tescase succeed.
Comment 1 Uroš Bizjak 2008-04-27 05:49:06 UTC
"IEEE Std 1003.1, 2004 Edition" [1] says:

Conversions can be applied to the nth argument after the format in the argument list, rather than to the next unused argument. In this case, the conversion specifier character % (see below) is replaced by the sequence "%n$", where n is a decimal integer in the range [1,{NL_ARGMAX}], giving the position of the argument in the argument list. This feature provides for the definition of format strings that select arguments in an order appropriate to specific languages (see the EXAMPLES section).

[1] http://www.opengroup.org/onlinepubs/009695399/functions/printf.html

Due to this, I would say that "%n$" is not non-standard.
Comment 2 Danny Smith 2008-04-27 06:03:00 UTC
Changed summary to be more precise about "non-standard".

Comment 3 Andrew Pinski 2008-05-12 20:41:24 UTC
I saw this too.
Comment 4 Andrew Pinski 2008-05-12 20:41:50 UTC
(In reply to comment #3)
> I saw this too.

On cygwin.
Comment 5 Uroš Bizjak 2008-05-17 13:10:01 UTC
(In reply to comment #4)

> > I saw this too.
> On cygwin.

Sigh. Patch at http://gcc.gnu.org/ml/gcc-patches/2008-05/msg01019.html.

Comment 6 uros 2008-05-20 19:02:30 UTC
Subject: Bug 36057

Author: uros
Date: Tue May 20 19:01:46 2008
New Revision: 135671

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=135671
	PR testsuite/36057
	* g++.dg/compat/struct-layout-1_generate.c (DG_OPTIONS): Remove.
	(const char *dg_options): New array.
	(switchfiles): Loop through dg_options array to generate dg-options
	directives.  Remove numbered arguments usage from fprintf
	format strings.


Comment 7 Uroš Bizjak 2008-05-20 19:06:14 UTC