On Thu, Mar 8, 2012 at 10:29 AM, Conrado P. L. Gouvêa <conrado...@gmail.com> wrote: > On Thu, Mar 8, 2012 at 09:35, Peter Bigot <big...@acm.org> wrote: >> Yes, unless it is marked as "hosted" main is handled specially; there >> has been recent discussion about why in a thread about creating >> archives that contain the main routine. See also >> http://www.mail-archive.com/mspgcc-users@lists.sourceforge.net/msg09750.html. >> > > Thanks Peter. Indeed, marking it as hosted, the bug vanishes. > > By the way, I may be completely wrong, but wouldn't it make sense to > use the GCC flag "-fhosted" to control this behaviour? (Sometimes it > is easier to change the compile flags than changing the code > itself...)
No, because mspgcc doesn't support a true hosted environment: there is no standard way to pass in arguments or process a return value from main, and the full standard library is not available. mspgcc just provides a way for the application developer to ensure that the generated main will fit with a hosted environment provided by some external system. Thanks for the bug report; I confirm it's doing the wrong thing as the intended common exit point is being collapsed and the incorrect return value is being provided as well as improperly calling the subroutine. Probably an errant jump chaining optimization. Will look into this soon. Peter >> At a quick glance does appear that the second call is not appropriate, >> though the return value is right (r15 has the correct value when main >> is left). If you'd like this investigated, please file a ticket on >> the tracker. https://sourceforge.net/tracker/?group_id=42303&atid=432701 >> > > It seems to me that the return value is also wrong. It always returns > 1, when it should return 0 when entering the "if". > > I've filed the ticket. > > Conrado > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Mspgcc-users mailing list > Mspgcc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mspgcc-users ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users