From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.68.209.201 with SMTP id mo9mr37867748pbc.8.1432022070699; Tue, 19 May 2015 00:54:30 -0700 (PDT) X-Received: by 10.140.80.168 with SMTP id c37mr112545qgd.39.1432022070649; Tue, 19 May 2015 00:54:30 -0700 (PDT) Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!j8no5423736igd.0!news-out.google.com!t92ni23945qga.1!nntp.google.com!z60no2199301qgd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 19 May 2015 00:54:30 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=105.237.126.3; posting-account=orbgeAkAAADzWCTlruxuX_Ts4lIq8C5J NNTP-Posting-Host: 105.237.126.3 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <2cfd12ff-e3dc-44c2-a462-aefd3ff5b8c4@googlegroups.com> Subject: Gnat for ARM : are these bugs? From: jan.de.kruyf@gmail.com Injection-Date: Tue, 19 May 2015 07:54:30 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: number.nntp.giganews.com comp.lang.ada:193224 Date: 2015-05-19T00:54:30-07:00 List-Id: Hallo, I was doing some code patterns for a little Oberon compiler, as a diversion in my free time. And 2 most extraorinary features popped up : 1. its seems to be illegal to to assign 2 ** 0 ( = 1) to a mod type. 2. on a illegal assignment like 2 ** 32 to a 32 bit mod type the answer is a big fat zero with no questions asked. Does anybody have an explanation that I might have overlooked? Thanks j. --- here is the relevant code and the assembler output from gcc -- compiled with arm-eabi-gcc -S -mtune=cortex-m4 -mfloat-abi=hard patset.adb procedure Patset is type Set is mod 2**32; N : Integer; -- stored at stackpointer + 4 S : Set; -- stored at stackpointer + 0 begin S := 2 ** N; end Patset; ---------------------------------------------------------- _ada_patset: @ args = 0, pretend = 0, frame = 8 @ frame_needed = 1, uses_anonymous_args = 0 push {r7, lr} -- procedure start sub sp, sp, #8 add r7, sp, #0 ldr r3, [r7, #4] -- load 'N' cmp r3, #0 -- if 0 then exception bge .L2 -- else .L2 movw r0, #:lower16:.LC0 -- last chance handler set up movt r0, #:upper16:.LC0 mov r1, #8 bl __gnat_last_chance_handler .L2: ldr r3, [r7, #4] -- load 'N' cmp r3, #31 -- if N > 31 then .L3 bgt .L3 ldr r3, [r7, #4] -- else normal processing mov r2, #1 lsl r3, r2, r3 b .L4 .L3: mov r3, #0 -- on error my set becomes {} .L4: str r3, [r7, #0] Nop -- procedure end game add r7, r7, #8 mov sp, r7 pop {r7, pc} --------------------------------------------------------------