From 39027a6ea0446b45d2c8aee1eb0c256a6f0f7417 Mon Sep 17 00:00:00 2001 From: xleroy Date: Sun, 7 Jul 2013 08:41:55 +0000 Subject: Bad printing of alignment on 'comm' symbols. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2291 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- cfrontend/CPragmas.ml | 8 ++++++-- cparser/PackedStructs.ml | 4 ++-- powerpc/PrintAsm.ml | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cfrontend/CPragmas.ml b/cfrontend/CPragmas.ml index 5ae147e..a31378e 100644 --- a/cfrontend/CPragmas.ml +++ b/cfrontend/CPragmas.ml @@ -37,9 +37,13 @@ let process_section_pragma classname istring ustring addrmode accmode = (* #pragma use_section *) +let re_c_ident = Str.regexp "[A-Za-z_][A-Za-z_0-9]*$" + let process_use_section_pragma classname id = - if not (Sections.use_section_for (intern_string id) classname) - then C2C.error (sprintf "unknown section name `%s'" classname) + if not (Str.string_match re_c_ident id 0) then + C2C.error (sprintf "bad identifier `%s' in #pragma use_section" id); + if not (Sections.use_section_for (intern_string id) classname) then + C2C.error (sprintf "unknown section name `%s'" classname) (* #pragma reserve_register *) diff --git a/cparser/PackedStructs.ml b/cparser/PackedStructs.ml index ebf210b..13a00ce 100644 --- a/cparser/PackedStructs.ml +++ b/cparser/PackedStructs.ml @@ -525,9 +525,9 @@ let rec transf_globdecls env accu = function (Env.add_typedef env id ty) (g :: accu) gl - | Genumdef _ -> + | Genumdef(id, attr, el) -> transf_globdecls - env + (Env.add_enum env id {ei_members = el; ei_attr = attr}) (g :: accu) gl | Gpragma p -> diff --git a/powerpc/PrintAsm.ml b/powerpc/PrintAsm.ml index ab8b4f3..879d755 100644 --- a/powerpc/PrintAsm.ml +++ b/powerpc/PrintAsm.ml @@ -1144,7 +1144,7 @@ let print_var oc name v = (if C2C.atom_is_static name then ".lcomm" else ".comm") symbol name (Z.to_string sz) - (1 lsl align) + align end let print_globdef oc (name, gdef) = -- cgit v1.2.3