public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/63725] New: Scalar_Storage_Order is required for nested string types, but cannot be added to those types
@ 2014-11-03 16:05 daniel.merrill at psware dot com
2014-11-06 8:40 ` [Bug ada/63725] Scalar_Storage_Order and nested string subtypes daniel.merrill at psware dot com
0 siblings, 1 reply; 2+ messages in thread
From: daniel.merrill at psware dot com @ 2014-11-03 16:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63725
Bug ID: 63725
Summary: Scalar_Storage_Order is required for nested string
types, but cannot be added to those types
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: daniel.merrill at psware dot com
Created attachment 33878
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33878&action=edit
demonstrates the problem with nested string types and scalar storage order
Target: i686-pc-linux-gnu
Configured with: ../configure --enable-languages=c,c++,ada --disable-multilib
--
with-gcc --with-gnu-ld --with-gnu-as --target=i686-pc-linux-gnu
--prefix=/c/gcc-
ade -v --with-sysroot=/c/gcc-ade/i686-pc-linux-gnu
--includedir=/c/gcc-ade/i686-
pc-linux-gnu/usr/include
Thread model: posix
gcc version 4.10.0 20140706 (experimental) (GCC)
This is a build of the svn://gcc.gnu.org/svn/gcc/branches/scalar-storage-order
branch.
when the following is defined and compiled with "gnatmake main.adb":
subtype string_type is string (1..15);
type string_array is array (1..2) of string_type;
for string_array'Scalar_Storage_Order use System.High_Order_First;
type BigEndianInt32Array is array (1..10) of int32;
type bigEndianType is record
ThirtyTwoBits : int32;
SixteenBits : int16;
TestStrings : string_array;
end record;
for bigEndianType use record
ThirtyTwoBits at 0 range 0 .. 31;
SixteenBits at 0 range 32 .. 47;
TestStrings at 0 range 48 .. 79;
end record;
for bigEndianType'Bit_Order use System.High_Order_First;
for bigEndianType'Scalar_Storage_Order use System.High_Order_First;
the following compiler error is produced:
main.adb:17:04: nested composite must have explicit scalar storage order
You are unable to fix this because the nested type is a subtype of string and
you cannot define a scalar_storage_order attribute for a subtype.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug ada/63725] Scalar_Storage_Order and nested string subtypes
2014-11-03 16:05 [Bug ada/63725] New: Scalar_Storage_Order is required for nested string types, but cannot be added to those types daniel.merrill at psware dot com
@ 2014-11-06 8:40 ` daniel.merrill at psware dot com
0 siblings, 0 replies; 2+ messages in thread
From: daniel.merrill at psware dot com @ 2014-11-06 8:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63725
--- Comment #2 from Dan Merrill <daniel.merrill at psware dot com> ---
Is this what you are proposing?
type string_type is new string (1..15);
for string_type'Scalar_Storage_Order use System.High_Order_First;
type string_array is array (1..2) of string_type;
for string_array'Scalar_Storage_Order use System.High_Order_First;
type BigEndianInt32Array is array (1..10) of int32;
type bigEndianType is record
ThirtyTwoBits : int32;
SixteenBits : int16;
TestStrings : string_array;
end record;
for bigEndianType use record
ThirtyTwoBits at 0 range 0 .. 31;
SixteenBits at 0 range 32 .. 47;
TestStrings at 0 range 48 .. 287;
end record;
for bigEndianType'Bit_Order use System.High_Order_First;
for bigEndianType'Scalar_Storage_Order use System.High_Order_First;
?
That seems to work, but in a non trivial case doesn't that make string_type non
inter operable with other string types? In reality I don't care what the scalar
storage order of the string is because they are just bytes and should work the
same across both platforms. It seems like string_type shouldn't even need a
scalar storage order applied to it.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-06 8:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-03 16:05 [Bug ada/63725] New: Scalar_Storage_Order is required for nested string types, but cannot be added to those types daniel.merrill at psware dot com
2014-11-06 8:40 ` [Bug ada/63725] Scalar_Storage_Order and nested string subtypes daniel.merrill at psware dot com
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).