Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8882973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:42:18+00:00 2026-06-14T20:42:18+00:00

at first excuse me for not providing any code, but it’s hard to just

  • 0

at first excuse me for not providing any code, but it’s hard to just C+P an excerpt, since the errors are caused somehow randomly.

I am encountering a very strange error when compiling my C source with GCC. I am developing a linked-in driver for Erlang, and I do not understand what is causing the error. The error goes like this:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xffffffffb012aae8
[Switching to process 7316 thread 0x1503]
ktqk_exec (query=0x13e0af00, table=0x13e00ea0) at ktqk.c:215
215   clock_t start = clock();

I am running the Erlang virtual machine wrapped with GDB, so I can access the memory sections. To me, the high address 0xffffffffb012aae8 looks very suspicious. However, with Clang everything works as expected, no errors, no segfaults. I tried to investigate:

(gdb) p clock
$1 = {<text variable, no debug info>} 0x7fff85c29fd0 <clock>
(gdb) p start
$2 = 2954013712

So the value was obviously not initialized, it crashed before. When I set breakpoints in the same file, they are simply skipped. Why does everything work with Clang, but not with GCC?

Since Clang uses C99 and GCC C89 by default, I had to included the -std=c99 flag for compilation on GCC. May this be a potential source? However, when I comment out the code above, it fails at the next function call. So it seems somehow related to function calls. Nevertheless, all function calls before this line are fine.

A very strange error. Does anybody have any ideas? Sorry for this rather fuzzy explanation, I am simply not understanding the error.

All the best,
Martin

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:42:19+00:00Added an answer on June 14, 2026 at 8:42 pm

    I can answer my own question: the code that was causing the error can be found below:

    ...
    int select = -1;
    
    for (int p = 0; p < SIZE_KEYS; p++)
      if (parts[p] == query->count && (select == -1 || sizes[p] < sizes[select]))
        select = p;
    
    int *index[lists[select]];
    if (select != -1) {
      ...
    }
    ...
    

    So select was initialized to -1 and, if something would have been found, it would have been > 0. Now, in my example nothing was found, so select = -1. Putting the -1 in lists, the result was also lists[select] = -1, so obviously the same memory region as select. However, now we’re initializing a list of integer pointers of size -1. And that is clearly wrong.

    Why is Clang not complaining about this severe error!?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, please excuse any typo, English is not my native language. Here's
First of all, please excuse any typo as English is not my native language.
First off: I am not an expert, so please excuse any mistakes I make
First, excuse me please, this is not a programming question, but I think it
First excuse, since I am not an English native and even English language is
Excuse me first. because i don't know this is question is valid or not.
First of all, excuse my ignorance as this issue is not my specialty: I
First time poster, so please excuse any stupidity. I'm working on porting a custom
First of all, am not a Php geek.. so excuse my little knowledge around
Please excuse me for a probably low quality of this question, since I'm not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.