1 /* { dg-do compile } */
2 /* { dg-options "-Os -fno-strict-overflow" } */
3 
4 typedef unsigned char u8;
5 typedef unsigned short u16;
6 typedef unsigned int u32;
7 typedef u16 acpi_rs_length;
8 typedef u32 acpi_rsdesc_size;
9 struct acpi_resource_source
10 {
11   u16 string_length;
12   char *string_ptr;
13 };
14 static u16
acpi_rs_strcpy(char * destination,char * source)15 acpi_rs_strcpy (char *destination, char *source)
16 {
17   u16 i;
18   for (i = 0; source[i]; i++)
19     {
20     }
21   return ((u16) (i + 1));
22 }
23 union aml_resource;
24 acpi_rs_length
acpi_rs_get_resource_source(acpi_rs_length resource_length,acpi_rs_length minimum_length,struct acpi_resource_source * resource_source,union aml_resource * aml,char * string_ptr)25 acpi_rs_get_resource_source (acpi_rs_length resource_length,
26 			     acpi_rs_length minimum_length,
27 			     struct acpi_resource_source * resource_source,
28 			     union aml_resource * aml, char *string_ptr)
29 {
30   acpi_rsdesc_size total_length;
31   u8 *aml_resource_source;
32   if (total_length > (acpi_rsdesc_size) (minimum_length + 1))
33     {
34       resource_source->string_length =
35 	acpi_rs_strcpy (resource_source->string_ptr,
36 			((char *) (void *) (&aml_resource_source[1])));
37     }
38 }
39