[cfe-dev] lifetime marker for expression-emission temporaries

via cfe-dev cfe-dev at lists.llvm.org
Mon Aug 21 08:48:40 PDT 2017


Hi,

Due to the missing lifetime markers for temporary allocas, an 
unreasonable stack size burst was observed 
(https://bugs.llvm.org/show_bug.cgi?id=34173). Using the C code below, 
you can see the missing lifetime markers for temporary allocas for sret:

/* clang -Wframe-larger-than=1 -o bug bug.c -c -O1 */

struct a {
   int a; int b;
   int c; int d;
   int f; int g;
   int h; int i;
};

struct a test_callee(void);

int foo() {
   struct a b;
   b= test_callee();
   b= test_callee();
   b= test_callee();
   b= test_callee();
   b= test_callee();
   b= test_callee();
   return 0;
}

Based on John McCall's comment in Bug34173, the frond-end needs to be 
improved to properly add lifetime marks :
    Clang's adoption of lifetime markers has been rather piecemeal, 
especially for expression-emission temporaries like this. To do this 
properly, I think we'd need to honor full-expression lifetime implicitly 
rather than relying on ExprWithCleanups.

Honestly, I don't have much experience in the front-end and I have other 
issues to handle in priority. Is there anyone who can volunteer for this 
issue ?

Thanks,
Jun


-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm 
Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a 
Linux Foundation Collaborative Project.



More information about the cfe-dev mailing list