Bug 139991 - "unaligned access" message is output
"unaligned access" message is output
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel (Show other bugs)
4.0
ia64 Linux
medium Severity medium
: ---
: ---
Assigned To: Dave Jones
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-11-19 00:48 EST by L3support
Modified: 2015-01-04 17:12 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-01-24 13:25:52 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description L3support 2004-11-19 00:48:45 EST
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
Comment 1 Jakub Jelinek 2004-11-19 01:18:34 EST
It is not emitted to stderr, rather kernel is writing that message.
It has nothing to do with gcc.
Comment 3 RHEL4-L3support 2005-01-18 21:08:04 EST
Add RHEL4-L3support team in Japan
Comment 6 Jakub Jelinek 2005-01-24 04:03:19 EST
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
Comment 8 JoAnne K. Halligan 2005-01-24 13:25:52 EST
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


Note You need to log in before you can comment on or make changes to this bug.