Exactly, and I think the same should apply to a "BALR 14,15".

mario

On 11/22/21 6:46 PM, Charles Mills wrote:
Compiler has no way of knowing whether cFunction() has side effects. For example, it 
might do a printf() that you would "miss" if the call were optimized out.

Charles


-----Original Message-----
From: IBM Mainframe Assembler List [mailto:[email protected]] On 
Behalf Of Mario Bezzi
Sent: Monday, November 22, 2021 9:37 AM
To: [email protected]
Subject: Re: Curious compiler optimization

Apparently not..

int cGlue(void *functParms) {

   int cFuction(void *);

   int functRC = cFunction(functParms);

   return 0;
}


SOURCE,XREF,SSCOMM,LIST,LANGLVL(EXTENDED),LONGNAME,ASM,RENT,OPT(3)

000D8                    End of Prolog

                           000002 | *
                           000003 |       *   int cFuction(void *);
                           000004 | *
                           000005 |       *   int functRC =
cFunction(functParms);
000D8  5800  1000        000005 |                   L r0,functParms(,r1,0)
000DC  58F0  3000        000005 |                   L
r15,=V(cFunction)(,r3,0)
000E0  4110  D098        000005 |                   LA
r1,#MX_TEMP1(,r13,152)
000E4  5000  D098        000005 |                   ST
r0,#MX_TEMP1(,r13,152)
000E8  0DEF              000005 |                   BASR r14,r15
                           000006 | *
                           000007 |       *   return 0;
000EA  41F0  0000        000007 |                   LA r15,0
                           000008 |       * }
000EE                    000008 |        @1L1       DS 0H

000EE                    Start of Epilog


On 11/22/21 6:21 PM, Peter Relson wrote:
Maybe you'd get
the same effect with this program if the __asm was instead a "call" to an
external routine.

Reply via email to