Do you get this warning?

warning: initialization discards qualifiers from pointer target type

If you try to modify an object declared const, you're into undefined behaviour territory.