Problem getting state and toggling output pin on Arduino Due

Hi,
I have got a problem with toggling and getting current state of the output pin on Arduino Due and Arduino 1.5.2 software.
The pin stays high all the time and digitalRead(pinnum) always returns 0.
Tried with this code and some variations of it.

int pinnum = 13;
void setup() {
  pinMode(pinnum, OUTPUT);  // use on-board LED
} 

void loop() {
  digitalWrite(pinnum, !digitalRead(pinnum));
  delay(1000);  // wait around for 1 sec (1000 ms)
}

I would appreciate help very much.

Euhenio:
I have got a problem

What is the problem?

PeterH:
What is the problem?

The pin stays high all the time and digitalRead(pinnum) always returns 0. The code I've posted earlier doesn't blink led.
Sorry, forgot to describe the problem in first post. Edited.

On the Due, possibly reading an output pin may always return 0. After all, reading from output is not necessarily defined.

I'm moving this to the Due section of the forum.

Is there any work around for this? Or determining current state of output pin is not really possible on Due?

Make your own function, that when you do a digitalWrite, it remembers what you set it to.

I personally think, that when you set something as "output" it isn't all that valid to read from it. It's your job to remember what you last wrote.

Ok, I got the idea. Thanks for help.