This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Null string literals in non-static context


The lower bound of a string literal is set to the 'First of the base type of
the index type, when the lower bound of the context type is non-static. This
is problematic if the string is an empty string and the base type is Integer,
because then the uppper bound is not representable. Given that the string is
always converted to the type of the context, simplest is to set lower bound
of literal to 1, as when the context type is String.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-08-03  Ed Schonberg  <schonberg@adacore.com>

	* sem_res.adb (Set_String_Literal_Subtype): if index type is an integer
	type, always use 1 as the lower bound or string, even if lower bound of
	context is not static, to handle properly null strings in a non-static
	context.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]