comp.lang.ada
 help / color / mirror / Atom feed
From: jan.de.kruyf@gmail.com
Subject: Gnat for ARM : are these bugs?
Date: Tue, 19 May 2015 00:54:30 -0700 (PDT)
Date: 2015-05-19T00:54:30-07:00	[thread overview]
Message-ID: <2cfd12ff-e3dc-44c2-a462-aefd3ff5b8c4@googlegroups.com> (raw)

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}

--------------------------------------------------------------


             reply	other threads:[~2015-05-19  7:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19  7:54 jan.de.kruyf [this message]
2015-05-19  8:42 ` Gnat for ARM : are these bugs? jan.de.kruyf
2015-05-19  8:44 ` Egil H H
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox