Description of problem: "unaligned access to xxxx" message is output to stderr when the program has alignment error. (The program is normally working.) Is it new specification of gcc? But there is no information to investigate the problem. So, I cannot find out the problem part in the program. The error message is output to syslog too. Syslog will be full of the error messages. It would be also a problem. I need to stop this error messages. How can I do for this? How can I investigate this error? Version-Release number of selected component (if applicable): gcc-3.4.1-10.ia64.rpm How reproducible: always Steps to Reproduce: 1. execute following sample program #include <stdlib.h> #include <stdio.h> void main() { char *p = malloc(100); int *i = p+1; *i = 0; printf("malloc = %p\n", p); } Actual results: following error is output c(6714): unaligned access to 0x6000000000004011, ip=0x40000000000007d1 malloc = 0x6000000000004010 Expected results: no error message would be output Additional info: none
It is not emitted to stderr, rather kernel is writing that message. It has nothing to do with gcc.
Add RHEL4-L3support team in Japan
My understanding was that the complaint was that unaligned messages shouldn't be printed by default (which is a kernel decision), but I could be wrong. Anyway, the "But there is no information to investigate the problem." claim is wrong. There is enough information in the message to investigate it: c(6714): unaligned access to 0x6000000000004011, ip=0x40000000000007d1 ^ program name ^ instruction where the error was found ^ pid ^ misaligned access it was accessing
This issue is closed a 'not a bug'. Please see the following comments. If this is not correct, or there is something else missing in our understanding please reopen the bug report and provide any additional needed information or comments. The case reported here in the above code seems to indicate a programming problem if we understand the message correctly. The code creates a character pointer, then manipulates it as an integer pointer. This would seem to end up accessing that char pointer on an unaligned boundary. When the integer types "i" was changed "int" to "char *" the resolved the issue. In other words, the kernel is merely complaining that the code is question is forcing an off-boundary memory access, and therefore the code in question should be cleaned up. As for the "But there is no information to investigate the problem" claim, there is enough information in the message to investigate it: c(6714): unaligned access to 0x6000000000004011, ip=0x40000000000007d1 ^ program name ^ instruction where the error was found ^ pid ^ misaligned access it was accessing