Thread View: comp.sys.transputer
3 messages
3 total messages
Started by Randy Brumbaugh
Wed, 07 Nov 1990 04:45
3L C & the poison constant!
Author: Randy Brumbaugh
Date: Wed, 07 Nov 1990 04:45
Date: Wed, 07 Nov 1990 04:45
49 lines
2072 bytes
2072 bytes
I feel I have had more than my fair share of problems with the
3L C compiler (IMHO). Now this . . .
The 3L compiler/ assembler doesn't like the constant 0x20800000.
Yes! That's right! It turns out that this is a very important
constant for my application. Here is the input:
func() { asm { ldc 0x20800000; } }
This will produce an error message about an undefined forward
reference. However, either of the following (very similar)
functions will compile:
func() { asm { ldc 0x30800000; } }
func() { asm { ldc 0x10400000; } }
Thinking it was the hex expression it didn't like, I tried good ol'
base 10:
func() { asm { ldc 545259520; } }
Same problem; same error. Then I thought I had a way to fool the
compiler: literal bytes of machine code. (It was VERY important
that I load this constant - it is an address for a memory
mapped i/o register ).
func() { asm { byte 0x22, 0x20, 0x28, 0x20, 0x20, 0x20, 0x20, 0x40;}}
But the compiler caught this and barfed again! It only seems
to happen in asm statements -- the C compiler can use the constant.
So? If anybody has an explanation for this that is even close to
rational, I'd really like to hear it! Or - if the error doesn't
happen on your system! I have V 2.0 of the compiler, which I admit
is one rev out, but this behavior is way out!
If you care, I did fool the compiler and load the constant like this:
func() {
asm { ldc 0x10400000;
ldc 2;
shl; } }
I also figured I could use Norton Utils and patch the .bin file. These
methods will work while I scrape money together for a Logical Systems
C compiler.
Randy Brumbaugh
rando@skipper.dfrf.nasa.gov
Re: 3L C & the poison constant!
Author: Randy Brumbaugh
Date: Wed, 07 Nov 1990 04:52
Date: Wed, 07 Nov 1990 04:52
7 lines
603 bytes
603 bytes
I meant "ldc 1" NOT "ldc 2" in the code at the end of the original posting. I expect I'll get enough interesting replies without this little mistake. Sorry.
Re: 3L C & the poison constant!
Author: Scott Galuska
Date: Thu, 08 Nov 1990 15:14
Date: Thu, 08 Nov 1990 15:14
38 lines
1865 bytes
1865 bytes
In article <671@skipper.dfrf.nasa.gov> rando@skipper.dfrf.nasa.gov (Randy Brumbaugh) writes:
>I feel I have had more than my fair share of problems with the
>3L C compiler (IMHO). Now this . . .
>The 3L compiler/ assembler doesn't like the constant 0x20800000.
>Yes! That's right! It turns out that this is a very important
>constant for my application. Here is the input:
>func() { asm { ldc 0x20800000; } }
>This will produce an error message about an undefined forward
>reference. However, either of the following (very similar)
>functions will compile:
Welcome to the club! I had a very similar problem- for me, it choked on
ldc 32; /* decimal */
And I tried also to fool it- I used hex, octal, binary. didn't like any of
'em!
What I eventually did was to assign the value to a variable outside of the asm
section and then use the variable. That worked.
>rational, I'd really like to hear it! Or - if the error doesn't
>happen on your system! I have V 2.0 of the compiler, which I admit
>is one rev out, but this behavior is way out!
This alos happened to me in V2.0. When I upgraded to V2.1, the error went
away. I also tried yours on V2.1- it compiled just fine.
--
Scott Galuska
Dept. of Computer & Info. Science
Univ of Delaware
galuska@dewey.udel.edu
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads