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 8675335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:55:30+00:00 2026-06-12T19:55:30+00:00

I have tried for a long time and cannot figure out where this ‘core

  • 0

I have tried for a long time and cannot figure out where this 'core dumped' is coming from. I am using c on cygwin. Commenting out the threads gets rid of the problem but commenting out the entire code in the thread does nothing. Could this have something to do with the calling of the thread?? It appeared to be working then this suddenly happened. I have deleted most of the code and this is what is left-

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <stdint.h>
#include <pthread.h>
#include <string.h>


typedef enum {true=1, false=0} bool;

void *piThread(void *arg);
int finished;

int main(int argc, char *argv[])
{
    int i;
    int threads;
    bool display = false;
    long double pI = 0.0;
    void *status = malloc(sizeof(int));
    pthread_t thread_id[threads];

    if(argc < 2) {printf("not enough arguments"); exit(1);
    }else threads = atoi(argv[1]);

    if(argc == 3)
        if (strcmp(argv[2], "b") == 0)
            display = true;

    for(i=0; i<threads; i++)
    {
            pthread_create(&thread_id[i], NULL, piThread, NULL);    
            pthread_join(thread_id[i], &status);
            printf("pi: %Lf\n", pI);
    }
    return 0;
}

void *piThread(void *arg)
{
    int number = 0;
    number = 74;
    pthread_exit((void*)number);
}

This is causing an aborted error.

Stack trace:
Frame     Function  Args
0028A6A4  76821184  (000000D0, 0000EA60, 00000000, 0028A7D8)
0028A6B8  76821138  (000000D0, 0000EA60, 000000A4, 0028A7B4)
0028A7D8  610DBE29  (00000000, FFFFFFFE, 77403B23, 77403B4E)
0028A8C8  610D915E  (00000000, 0028A918, 00000001, 00000000)
0028A928  610D962E  (76D709CD, 7427AED9, 00000003, 00000006)
0028A9D8  610D9780  (000011E8, 00000006, 002B002B, 800483D8)
0028A9F8  610D97AC  (00000006, 0028CE80, FFFDE000, 00000000)
0028AA28  610D9A85  (000000D0, 0028ABF0, 0028AA58, 610FA223)
End of stack trace

I have no idea what is wrong!!
command line is-
gcc pi.exe 100
any combination ABOVE 26 causes this fault.
Thank you for any insight

  • 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-12T19:55:31+00:00Added an answer on June 12, 2026 at 7:55 pm

    You are allocating thread_id before ‘threads’ is defined. This should fix that problem at least.

    if(argc < 2) {printf("not enough arguments"); exit(1);
    }else threads = atoi(argv[1]);
    pthread_t thread_id[threads];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried for a very long time now to figure out, why this
I have tried a long time to find help regarding a random date in
I have been trying to make this work for a long time now. In
Have tried to find solutions for this and can't really come up with anything.
I have tried searching over the internet about this problem but not able to
I have tried this: #define format(f, ...) \ int size = strlen(f) + (sizeof((int[]){__VA_ARGS__})/sizeof(int))
I am having a very tough time with this one. I have a Navigation
I have been working on a project for a long time now and there
This question is long winded because I have been updating the question over a
I have a complex action which can take a long time to run. If

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.