title: Program crashed when variable declaration sequence is changed
body: <p>I had a very weird program crash issue.<br>
  I have 2 same piece of codes "Code A" and "Code B" as below.<br>
  In "Code B" I have just changed the sequence of variable declaration.</p>
  
  <pre><code>/******** Code A ******/
  void MyFunction(char * ONOFF_Flag)
  {
      short l_subchoice_s ;
      char  l_subchoice_ca[1] = {'\0'};
      char  l_ProcessName_ca[30];
      char  l_reply_c = '\0';
      char  l_Type_c = 'P';
      char  l_ProcessName1_ca[30];
      char  l_TCPIP_ca[30];
      char  l_TCPIP1_ca[30];
  
      /*
      Data Processing Logic
      */
  }
  
  /******** Code B ******/
  void MyFunction(char * ONOFF_Flag)
  {
      char  l_reply_c = '\0';
      short l_subchoice_s ;
      char  l_subchoice_ca[1] = {'\0'};
      char  l_ProcessName_ca[30];
      char  l_Type_c = 'P';
      char  l_ProcessName1_ca[30];
      char  l_TCPIP_ca[30];
      char  l_TCPIP1_ca[30];
      /*
      Data Processing Logic
      */
  }
  </code></pre>
  
  <p>/* Data Processing Logic is as below */</p>
  
  <pre><code>printf("I"); /* CLSCR */
  printf("\t\t  ONLINE PARAMETER READ MENU");
  printf("\n\t\t  ==================================\n");
  printf("\n\t\t  1. Profile %s for one Server",ONOFF_Flag);
  printf("\n\t\t  2. Profile %s for ALL Servers",ONOFF_Flag);
  printf("\n\t\t  3. Return to Previous Menu");
  printf("\n\n\t\t  Enter choice  : ");
  scanf("%s",&amp;l_subchoice_ca);
  
  l_subchoice_s = (short) atoi(l_subchoice_ca);
  
  switch(l_subchoice_s)
  {
      case 1:
        AllorOneFlag ='O';
        printf("\n\n\n\t\tEnter server name  $");
        scanf("%s",&amp;l_ProcessName_ca);
  
        sprintf(l_ProcessName1_ca,"$%s",l_ProcessName_ca);
        memset(l_ProcessName_ca,'\0',strlen(l_ProcessName_ca));
        strcpy(l_ProcessName_ca,l_ProcessName1_ca);
        printf("\n\tDo you wish to do New Profile on/off the (Y/N)..?      :");
        scanf("%s",&amp;l_reply_c);
  
        while  (l_reply_c != 'y' &amp;&amp; l_reply_c != 'Y' &amp;&amp;l_reply_c != 'n' &amp;&amp; l_reply_c != 'N' )
        {
          printf("\n\t Invalid Choice; Press (Y/N)              :");
          scanf("%s",&amp;l_reply_c);
        }
  
          if(l_reply_c == 'y' || l_reply_c == 'Y' )
          {
            UpdateforOne(g_SystemNo_s, l_ProcessName_ca,l_Type_c);
          }
          break;
  
      case 2:
         AllorOneFlag ='A';
         printf("\n\tDo you wish to update parameter of ALL Servers (Y/N)..?      :");
         scanf("%s",&amp;l_reply_c);
         while  (l_reply_c != 'y' &amp;&amp; l_reply_c != 'Y' &amp;&amp;l_reply_c != 'n' &amp;&amp; l_reply_c != 'N' )
         {
           printf("\n\t    Invalid Choice; Press (Y/N)              :");
           scanf("%s",&amp;l_reply_c);
         }
         if(l_reply_c == 'y' || l_reply_c == 'Y' )
         {
           UpdateforAll(l_Type_c);
         }
          break;
  
      case 4:
         printf("I"); /* CLSCR */
         break;
  
      default:
          printf("\n\n\n\tThis is not a valid choice ");
  }
  </code></pre>
  
  <p>This code is running for very long time on our servers and recently for some new requirements I need to modify it. When I tried adding function Myfunction() which is copy of another similar function, program crashed.</p>
  
  <p>I did not get any compilation errors/warnings also.</p>
  
  <p>When I compile and run program using "Code A", the 
  program works fine but when the compilation is done using "Code B" i.e. change the variable declaration sequence, the program crashes.</p>
  
  <p>I tried to debug the issue and found some memory corruption issue but not able to find the root cause of this.</p>
  
  <p>Also this crash is not uniform, same program works fine on one system and gets crashed on another system. Same is the case on the system with 2 different logins. Program works with one login and crashes when compiled using another user.</p>
  
  <p>Is this byte alignment issue? If yes then can anyone explain in detail.</p>
  
  <p>I am running the program on HP Non-Stop G Series System where I faced the issue but 
  it works fine on HP Non-Stop H Series System.<br>
  Compiler used on G series Systems is "nmc" and on H series System is "ccomp"</p>