avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Add builtins in avr target.


From: Andy H
Subject: Re: [avr-gcc-list] Add builtins in avr target.
Date: Sat, 26 Apr 2008 13:06:00 -0400
User-agent: Thunderbird 2.0.0.12 (Windows/20080213)


As before I disagree.

But let Eric and users decide:

1) Should __builtin_return_address() be disable for 256K device. Since it will only return word not 3 bytes. 2) Should function pointer arithmetic be disabled for 256K device - since it will only operate on word address.

I think answer should be no. But there should be documented restrictions.

Andy

Anatoly Sokolov wrote:
Hi.

__builtin_return_address is extremely useful for target error reporting. e.g. a function can be called(or trapped) to report error in another part of program. This allows such routines to determine the address of the caller without using naked asm functions.

You are correct, that return address will only give 16bit pointer. But that covers most uses.

It would seem easier to implement than create documents and disable all current and future testcases that use it. That would seem to be confirmed by the fact that bug reports have been outstanding since 2005.

Of course, Eric and other AVR users may disagree.


Word or byte address return "__builtin_return_address"? I consider that, it will be better that it returned the word address.

For those architectures where it cannot return the correct address, the  
"__builtin_return_address" should be disabled.

+static void avr_init_builtins (void);

+#undef TARGET_INIT_BUILTINS
+#define TARGET_INIT_BUILTINS avr_init_builtins


+void
+avr_init_builtins  (void)
+{
+  if (AVR_HAVE_EIJMP_EICALL)  // if "__builtin_return_address" return word 
address.
+    {
+      disable_builtin_function ("return_address");
+    }
+}


Anatoly.
------------------------------------------------------------------------

_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list




reply via email to

[Prev in Thread] Current Thread [Next in Thread]