[Bug c/86092] New: global constant pointer optimization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86092 Bug ID: 86092 Summary: global constant pointer optimization Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: srinivas.sundar at vvdntech dot in Target Milestone: --- Here is my sample kernel code. which works fine in gcc-4, had an issue with gcc-5. I get both the print even if I allocate the dynamic memory to kern_buff_p. Disassemble of code gives the constant variable is optimized in the If statement. Can you provide me any FLAG to disable this optimization with this constant pointers. static char* const kern_buff_p; static int __init hello_start(void) { if(!kern_buff_p) printk(KERN_INFO "buffer is NULL for first time \n"); *((char**)(unsigned long int)((&kern_buff_p)))=kmalloc(KERN_BUF_SIZE,GFP_KERNEL); if(!kern_buff_p) printk(KERN_INFO "buffer is NULL for second time \n"); }
[Bug c/86092] global constant pointer optimization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86092 --- Comment #2 from Srinivas Achary --- Sorry that I am new to this. Is there any possibility to make this code work, without changing the variable attribute. GCC-4 has no issue with this code. What special flags have been included in the GCC-5. During disassemble the if(!kern_buff_p) -- is changed to if x0 is kern_buff_p mov x0, #0 This should be mov x0,[x0]
[Bug c/86092] global constant pointer optimization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86092 Srinivas Achary changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #3 from Srinivas Achary --- I have tried disabling all ipa FLAGS
[Bug c/86092] global constant pointer optimization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86092 --- Comment #5 from Srinivas Achary --- thank you Marc. What I have shown here is just an example sample code. But I have code which makes use of kern_buff_p variable in many place.If I use volatile that might reduce my code speed. Any how the kern_buff_p initial value is NULL and the variable have been allocated the memory during runtime without any issue. The problem is during compilation, the compiler optimizes all my conditional statements used with this constant pointers. Due to this, I am not able to run my code in New machines.
[Bug c/88126] New: Need Compiler warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88126 Bug ID: 88126 Summary: Need Compiler warning Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: srinivas.sundar at vvdntech dot in Target Milestone: --- int main() { unsigned long ul=4294967296; unsigned int var; var=ul; // how to get warning } The value of "var" will be different in 64bit system and 32bit system. Is it possible to get compilation warning in 64bit system.