http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52213

             Bug #: 52213
           Summary: Add chunk of memory if array is size is divisable with
                    8
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: jovica.sa...@gmail.com


When i create array of chars and before using I initialize char to some special
char value, like _. If char array size is divisible with 8, array became bigger
and filled with chunk of memory data. If you run attached sample code, you will
see. Interesting thing that is happened only with 8 divisors.

<code>

int main(){

    for (int i = 1; i < 100; i++){
        char* name = new char[i];
        for (int j=0; j<i; j++) {name[j] = '1';}
        int length = strlen(name);

        if(i != length){
            printf("Weird behaving for length of %d", i);
        }
        else{
            printf("Correct behaving for length of %d", i);
        }
        printf("\n");

    }

    return 0;

}

</code>

Reply via email to