Skip to content
Snippets Groups Projects
Commit c0ff75a7 authored by xleroy's avatar xleroy
Browse files

Bug in multidimensional read-only arrays

git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1290 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
parent 2bdad21e
No related branches found
No related tags found
No related merge requests found
...@@ -764,13 +764,14 @@ let convertProgram p = ...@@ -764,13 +764,14 @@ let convertProgram p =
(** ** Extracting information about global variables from their atom *) (** ** Extracting information about global variables from their atom *)
let type_is_readonly env t = let rec type_is_readonly env t =
let a1 = Cutil.attributes_of_type env t in let a = Cutil.attributes_of_type env t in
let a = if List.mem C.AVolatile a then false else
match Cutil.unroll env t with if List.mem C.AConst a then true else
| C.TArray(ty, _, _) -> a1 @ Cutil.attributes_of_type env ty match Cutil.unroll env t with
| _ -> a1 in | C.TArray(t', _, _) -> type_is_readonly env t'
List.mem C.AConst a && not (List.mem C.AVolatile a) | _ -> false
end
let atom_is_static a = let atom_is_static a =
try try
......
...@@ -35,11 +35,13 @@ int f(int n) ...@@ -35,11 +35,13 @@ int f(int n)
/* Redefining some standard sections */ /* Redefining some standard sections */
#pragma section SCONST ".myconst" ".myconst" far-absolute R #pragma section SCONST ".myconst" ".myconst" far-absolute R
#pragma section CONST ".myconst" ".myconst" far-absolute R
#pragma section DATA ".mysda_i" ".mysda_u" near-data RW #pragma section DATA ".mysda_i" ".mysda_u" near-data RW
#pragma section CODE ".mycode" ".mycode" standard RX #pragma section CODE ".mycode" ".mycode" standard RX
const double v = 1.414; const double v = 1.414;
int w[10]; int w[10];
const char t[5][5] = { 1, 2, 3 };
double h(int n) double h(int n)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment