GCC or Arduino compile malfuction

Hello to all,
I'm new here in this Forum. But I'm not new at all at this business. How ever the PCB and also the IDE was convince to use to get a quick result for my hardware.

I found now the third issue by compiling the code. So I will start now with the latest one and only to this. I was using this function before but I'd see the problem, because timing was not the base requirement on it.
The function I mean is: Serial.available();
It should only bring how many char or buffer in use. So far so good. Tested -> Output bring +1 if a key was pressed on the PC keyboard.
Step 2:
Reading the Char with: if (testSerial >= 10) {
//Sport1inc = Serial.read();
}
But wait! Where are the other one!? They are gone?
So you can see I remove the read instruction delete all files and recompile. Same story the count stay on 0.
OK. next step: only done this!! char Sport1inc = "a"; recompile!
Oh surprise testSerial is counting again.

So I guess, but I'm not sure this a problem of a Library from Arduino project. Because I have never seen like this before in my life as a Engineer.
If some one have a glue on it, feel free to answer. But I expect serious answer.

Sincerely to all

Mike

Ah I forgot Version is 1.6.5.

Please post a minimal complete sketch that demonstrates the issue. Use code tags (</> button on the toolbar). State what behavior you expect and what behavior you're encountering instead.

Dear pert,
on my first mail you can see already the minimal code.
As long I only use < testSerial = Serial.available(); >,
every thing is fine it will count the keys I pressed on PC until the Ringbuffer is full.

So far so good!
But if I define a variable lets say < char = thedamserialdata; >
with these instruction afterwards < if (testSerial >= 10) {
// thedamserialdata = Serial.read();
} >
It WILL NOT WORK! And as you can see in my sample < // >, it should not be read from MCU.
But the result of < Serial.print(testSerial); ) is ZERO.

Only if I make a stupid change < char = thedamserialdata = "a"; >.
The counting is shown again. I was testing this many time, even I clear the compiler output.

Background is, it slow also the program down, if it clear the Ringbuffer. I need "only some time" a few data from serial and I real not care, if other data are missing. The MCU have max. 63 buffer. So I need only 10 of them. The other anyway I skip to the bin.

I'd not like to do it with interrupt, It is the same as " you are on work, but always some one come to the door in and ask stupid.". This mean they steal your time, that’s the same with an MCU. So I have to ignore and use only what is in the memory.

By the way I did this before with Pascal and a other MCU with successes.

So in that moment I have no glue, why arduino IDE run so unexpected.
If you have any Idea, then please let me not die unknown.
Thank you in advance for your help.

mike_mike:
on my first mail you can see already the minimal code.

Nope. Not even close. This is the minimal code...

void setup( void ) { }
void loop( void ) { }

@pert's request...

Please post a minimal complete sketch that demonstrates the issue.

Fulfilling @pert's request is an excellent way to proceed. Anything else is a waste of your time and ours.

It appears that you do not understand the difference between a char, a char array, and a char pointer. The problems are NOT related to the compiler. The problem is CLEARLY that the user programming is deficient. Stop blaming the compiler for not understanding what you REALLY meant, when you can hardly explain it yourself.

Hello to all,
first I want to apologize me for the late answer and feed back.
But it tuck some while to figure the problem out and also to write the code proper.

Even I got some help from a other forum using ASM only.
So in short case is closed or in other words this tread can be closed.

Now to the issue and where it come from also my solution in short words.

The Origin of the problem ist not direct coming from GCC.
Also I discussed it with some owner of GCC.
The problem is coming from Arduino core header files.
But I not want to spend any time to clearout this mess.
Even it is clear written in the Arduino source.

QUOTE: " This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. " QUOTE END

So I apologize again for blaming. It just not fit to my projects!
Even I found out it is then not more saleable.
The solution I did was then in clear C++ with some original header files from Atmel.
For the function I was looking for. Well a good ghost from Germany (a Teacher) did it for me in ASM.

Because my ASM knowledge is lausi. But I promise my self that I will learn it. It have more benefit as I thought.
So thats all and cheers.

P.S. Some here have disqualified by them self. Also I showed this to some. hi hi hi The answer was quite the same: half wisdom, but show off.
How ever this is not the right IDE or forum for me.

mike_mike:
How ever this is not the right IDE or forum for me.

I agree, bye!