Hi!
----
Just for the log: The problem that C99 VLAs ("variable length arrays")
did not work in OS/net code has been fixed (for OS/Net B96).
-------- Original Message --------
Subject: CR 6575435 Updated P3 utility/ctf ctf tools cannot handle C99
VLAs("variable length arrays")
Date: Wed, 30 Jul 2008 17:20:45 -0600 (MDT)
From: [email protected]
To: undisclosed-recipients: ;
*Synopsis*: ctf tools cannot handle C99 VLAs ("variable length arrays")
CR 6575435 changed on Jul 30 2008 by <User 1-5HNZ8F>
=== Field ============ === New Value ============= === Old Value
=============
Fixed in Build
snv_96
Status 8-Fix Available 7-Fix in
Progress
====================== ===========================
===========================
*Change Request ID*: 6575435
*Synopsis*: ctf tools cannot handle C99 VLAs ("variable length arrays")
Product: solaris
Category: utility
Subcategory: ctf
Type: Defect
Subtype:
Status: 8-Fix Available
Substatus:
Priority: 3-Medium
Introduced In Release: solaris_9
Introduced In Build: s81
Responsible Engineer: <User 1-2P712V>
Keywords: opensolaris, oss-sponsor
=== *Description*
============================================================
Category
utility
Sub-Category
ctf
Description
Code in OS/Net currently cannot use C99 VLA ("variable length
array") statements like...
-- snip --
void x(int len)
{
char myarray[len];
/* ... */
}
-- snip --
... such code compiles with the compiler itself but the resulting binary
cannot be processed with "ctfconvert":
-- snip --
/opt/SUNWspro/bin/cc -O -K pic -xspace -Xa -xildoff -errtags=yes
-errwarn=%all -erroff=E_EMPTY_TRANSLATION_UNIT
-erroff=E_STATEMENT_NOT_REACHED -erroff=E_UNRECOGNIZED_PRAGMA_IGNORED
-xc99=%all -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1 -W0,-xglobalstatic -v
-xstrconst -g -xc99=%all -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1
-W0,-noglobal -xdebugformat=stabs -DTEXT_DOMAIN="SUNW_OST_OSLIB"
-D_TS_ERRNO -Isrc/cmd/ksh93 -I../common/include
-I/home/test001/ksh93/on_build1/test1_x86/proto/root_i386/usr/include/ast
-DKSHELL -DSHOPT_BRACEPAT -DSHOPT_CMDLIB_BLTIN=0
-DSH_CMDLIB_DIR="/usr/ast/bin" -DSHOPT_CMDLIB_HDR="solaris_cmdlist.h"
-DSHOPT_DYNAMIC -DSHOPT_ESH -DSHOPT_FILESCAN -DSHOPT_HISTEXPAND
-DSHOPT_KIA -DSHOPT_MULTIBYTE -DSHOPT_NAMESPACE -DSHOPT_OPTIMIZE
-DSHOPT_PFSH -DSHOPT_RAWONLY -DSHOPT_SUID_EXEC -DSHOPT_SYSRC -DSHOPT_VSH
-D_BLD_shell -D_PACKAGE_ast -DERROR_CONTEXT_T=Error_context_t
-DUSAGE_LICENSE= "[-author?David Korn <dgk at research.att.com>]"
"[-copyright?Copyright (c) 1982-2007 AT&T Knowledge Ventures]"
"[-license?http://www.opensource.org/licenses/cpl1.0.txt]"
"[--catalog?libshell]" -DPIC -D_REENTRANT -c -o pics/bltins/read.o
../common/bltins/read.c
ERROR: ctfconvert: pics/bltins/read.o: Couldn't parse stab
"#vla0:(0,14)" (source file pics/bltins/read.o)
Removing pics/bltins/read.o
*** Error code 1
The following command caused the error:
/usr/ccs/bin/mcs -d -a "@(#)SunOS 5.11 test1_x86 October 2007"
pics/bltins/read.o ;
/home/test001/ksh93/on_build1/test1_x86/usr/src/tools/proto/opt/onbld/bin/i386/ctfconvert
-i -L VERSION pics/bltins/read.o
make: Fatal error: Command failed for target `pics/bltins/read.o'
Current working directory
/home/test001/ksh93/on_build1/test1_x86/usr/src/lib/libshell/i386
-- snip --
This problem is very frustrating since the matching code needs to be
"downgraded" to use |malloc()|, resulting in a significant performance
loss.
Frequency
Always
Regression
No
Steps to Reproduce
1. Add a VLA statement to existing code.
2. Compile the source
3. Run "ctfconvert"
Expected Result
"ctfconvert" works without problems.
Actual Result
"ctfconvert" fails.
Error Message(s)
ERROR: ctfconvert: pics/bltins/read.o: Couldn't parse stab
"#vla0:(0,14)" (source file pics/bltins/read.o)
Removing pics/bltins/read.o
Test Case
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void print2(const char *s1, const char *s2)
{
char buff[strlen(s1)+strlen(s2)+1];
sprintf(buff, "%s%s", s1, s2);
puts(buff);
}
int main( void )
{
print2("hello", "world");
return EXIT_SUCCESS;
}
Workaround
No workaround possible.
|alloca()| only operates on function level and cannot be used in loops
blocks (which would exhaust the stack space depending on the number of
loop iterations).
Submitter wants to work on bug
No
Additional configuration information
Solaris 11/B61
*** (#1 of 1): 2007-06-29 03:45:26 GMT+00:00 <User 1-F4SZV>
=== *Workaround*
=============================================================
=== *Additional Details*
=====================================================
Targeted Release: solaris_nevada
Commit To Fix In Build: snv_96
Fixed In Build: snv_96
Integrated In Build:
Verified In Build:
See Also: 6379193, 5035276
Duplicate of:
Hooks:
Hook1:
Hook2:
Hook3:
Hook4:
Hook5: <email address omitted>
Hook6: <email address omitted>
Program Management:
Root Cause: Inadequate Algorithm
Fix Affects Documentation: No
Fix Affects Localization: No
=== *History*
================================================================
Date Submitted: 2007-06-29 03:45:26 GMT+00:00
Submitted By: <User 1-F4SZV>
Status Changed Date Updated Updated By
5-Cause Known 2007-06-29 12:55:33 GMT+00:00 <User 1-UM-1812>
6-Fix Understood 2008-05-14 01:41:58 GMT+00:00 <User 1-2P712V>
7-Fix in Progress 2008-07-19 00:29:59 GMT+00:00 <User 1-2P712V>
8-Fix Available 2008-07-30 23:10:51 GMT+00:00 <User 1-5HNZ8F>
=== *Service Request*
========================================================
Impact: Critical
Functionality: Primary
Severity: 1
Product Name: solaris
Product Release: solaris_nevada
Product Build: snv_61
Operating System: solaris_nevada
Hardware: generic
Submitted Date: 2007-06-29 03:45:27 GMT+00:00
=== *Multiple Release (MR) Cluster* - 0
======================================